jQuery Image Resize Plugin v2.0

29 Comments

I found out there was already a jQuery plugin called ‘resize’ so I renamed my plugin to .aeImageResize

I also have included a better minified version of the plugin.

You can download the latest version from here

29 Comments (+add yours?)

  1. Adeptus
    Jun 26, 2010 @ 08:06:54

    Great work! Tnx!

    Reply

  2. George Brackett
    Jul 14, 2010 @ 01:00:11

    How would you alter the code (which is wonderfully fast) to center the image in the box defined by the max width and max height? I’ve tried with a jquery .css call and it doesn’t work (for me, at least).

    Reply

    • Adeel Ejaz
      Jul 14, 2010 @ 09:12:15

      The plugin doesn’t create a box but the simplest possible way of doing it will be:

      <!-- between <head> and </head> -->
      <style>
      .imgbox{display:block;text-align:center}
      </style>

      <!-- add around images being resized in <body> -->
      <span class=imgbox><img src="sample.jpg" height=250 width=250></span>

      Reply

  3. Crash
    Aug 11, 2010 @ 16:16:56

    I realy like your plugin but i can’t get it to work in safari 5 an the MAC (it works in other brwosers). Do you have any sugestions how i could fix this.

    Thx

    Reply

  4. Ian
    Aug 17, 2010 @ 14:05:31

    Excellent plug-in although I noticed a small bug: It will only resize with the correct aspect ratio if I either:
    (a) don’t specifiy a width and height in the image tag,
    or
    (b) specify a width and height in the image tag that is also of the same aspect ratio as the resize I’m requesting.
    This is unfortunate, as it means a large image that you want reduced will still be displayed large if javascript is turned off.
    Thanks

    Reply

    • Adeel Ejaz
      Aug 17, 2010 @ 14:26:48

      Thanks for your input and really interesting find.. I have a potential fix in mind.. I’ll upload a new version tonight.

      Reply

  5. Ian
    Aug 20, 2010 @ 15:45:32

    Hi Adeel, I’m eagerly awaiting that fix! Any luck?

    Reply

  6. Ian
    Aug 24, 2010 @ 16:50:29

    Hi Adeel,
    Thanks it’s working a lot better now!
    One bug I noticed though: If I have a source image of size: 120×90
    and I want to resize it to 120×72, it will keep it at 120×90 and not resize it.
    I think this problem occurs when the new width is the same as the original width, but the new height is different.

    Reply

  7. Ian
    Aug 25, 2010 @ 16:11:59

    Awesome. It works a treat, cheers :)

    Reply

  8. design web london
    Sep 08, 2010 @ 12:27:36

    @Adeel Ejaz : I go an issue ….. I am loading images into a DIV with ajax now inside the dive i am populating images which belongs to that use so using php for that now i included jquery … your plugin and initiated it as its shown in your recent version example.html but the problem is it wont resize …… i tried to call that file which i call from ajax directly into the browser and it worked perfect that means there is some kind of missing function or i am doing something wrong to populate it inside the div….. any help ?

    Reply

    • Adeel Ejaz
      Sep 08, 2010 @ 15:39:02

      Are you using jQuery for AJAX? If yes, then you will need to call the aeImageResize function from within the AJAX success function. It would be something like:

      $.ajax({
      url: 'ajax.php',
      success: function(data) {
      $('img').aeImageResize();
      }
      });

      If you can show me an example code, I can help you further. You can use the contact form to email me if you do not want it to be public.

      Reply

      • design web london
        Sep 10, 2010 @ 09:35:11

        thanks for your reply….

        actually what i am doing is here

        HTML :
        art

        $(document).ready(function(){
        $(“#art”).click(function(){
        $(“#response”).load(“art.php”);
        });
        });

        now when i click on art then the images belonging to the person who is in session loads in side the response div and i included the javascript file inside the div and initiating your function also inside the div but it wont resize the images ….. but when i call art.php directly from browser it works perfectly ? any suggestions …

        Reply

        • Adeel Ejaz
          Sep 10, 2010 @ 12:09:03

          The function assumes that the image has already been loaded so try the following:

          $(document).ready(function(){
          $('#art').click(function(){
          $('#response').load('art.php', function() {
          $('#response img').aeImageResize();
          });
          });
          });

          Reply

  9. Andy H
    Oct 14, 2010 @ 10:08:31

    Resizes in Firefox, but leaves ‘jaggies’
    Looks good in IE, Chrome
    Anyway of getting better image quality in Firefox?

    Great solution otherwise
    Thanks
    Andy

    Reply

  10. Andy
    Oct 21, 2010 @ 15:10:33

    Hi Adeel

    Did you manage to fix the Firefox issue with jQuery Image Resize Plugin v2.0
    ?
    I emailed you the scree grabs.
    Thanks
    Andy

    Reply

  11. Brian Tully
    Oct 22, 2010 @ 00:05:00

    Great plugin!

    I downloaded the plugin linked directly from the jQuery plugin site (not sure what version it is) and it works well.

    However I downloaded the latest version (2.0.5) that you list on GitHub and it’s not working for me when I only pass in the width as a parameter, e.g.:

    $(“.resizeme”).aeImageResize({width: 250});

    Any idea why it doesn’t resize when only one dimension is passed vs. the older version that works from the jQuery site?

    Also, just a suggestion — you might want to include the version # as a comment within the downloaded source :)

    Thanks again!
    Brian

    Reply

    • Adeel Ejaz
      Oct 25, 2010 @ 12:34:26

      Thanks for reporting the issue Brian, I think I know why the plugin has stopped working in the latest version. I’ll release a fix soon (somewhere today!)

      PS: Thanks for the suggestion about the version comment in the code, will get it done as well.

      Reply

  12. Brian Tully
    Oct 26, 2010 @ 16:55:22

    Hey there Adeel. Any update on that fix?

    I was able to get the latest version to work by reversing the (imgAspectRatio > aspectRatio) to (aspectRatio > imgAspectRatio), but not sure if that causes other issues outside of my usage.

    Any help would be appreciated :)

    Reply

  13. Andrew
    Jan 14, 2011 @ 03:39:17

    Have you seen shadowbox, the javascript image viewer? In shadowbox an image is resized live as the window is resized. Is that what this script does? I’m looking for a plugin that will dynamically resize an image live, as the browser window is resized.

    Reply

    • Adeel Ejaz
      Jan 14, 2011 @ 23:09:31

      No, this plugin just resizes on page load or whenever the plugin is called.

      Reply

  14. Hot Celebrity Gallery
    May 26, 2011 @ 23:22:49

    nice plugin to share… !!! I tink I need it for my new site

    Reply

  15. dude
    Apr 24, 2012 @ 19:45:20

    dude. wtf? no demo. not even an explanation of what occurs in your logic!?!

    FAIL

    Reply

Leave a Reply