ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Image Sizer going a little crazy

January 02, 2013 2:21pm

Subscribe [2]
  • #1 / Jan 02, 2013 2:21pm

    Peter Smith

    69 posts

    We’re using Image Sizer (http://devot-ee.com/add-ons/image-sizer) on a site running EE 2.3.1 and MSM.

    I noticed that the plugin is generating thousands of resized images today and yesterday and I’m not sure why but it’s having an impact on site performance, I believe.

    For example, on just one of the sites, the plugin created 2,171 resized images today and 2,254 yesterday.

    I’m still sifting through the data to find out what all these images are—but I have to think it has resized every image on the site. I assume that the cache got whacked somehow…

    Anyway just wondering if anyone has seen an issue similar to this one, using this plugin.

    If I figure out what’s going on I’ll post in this thread.

    (The support thread on devot-ee is set to read-only, unfortunately.)

  • #2 / Jan 02, 2013 3:48pm

    MadWebDesigns

    147 posts

    Hi Peter,

    In case you don’t get any response from the EE forum you should contact the dev who created this add-on directly from here:

    http://area-photos.com/pictures/gulf_oil_spill/

    Once on the page above, click the “Contact Me” button at the top of the page to email the dev about your issue directly.

    Cheers,

    Mike

  • #3 / Jan 02, 2013 4:16pm

    Peter Smith

    69 posts

    Thanks Mike,

    I was under the impression the dev no longer supported the plugin but it couldn’t hurt to try!

  • #4 / Jan 03, 2013 5:34pm

    Peter Smith

    69 posts

    Still working through this issue but I think it has something to do with the fact that we’re pulling images from a ‘remote’ server. (Not physically remote but it has a different domain name.) That means Image Sizer needs to make a local copy of the image and then modify it, and it seems to want to go back and recheck the remote image periodically. By default it seems to be 1 day if I’m reading this correctly:

    $refresh = 1440; // this is the default
    $remote_diff  = round((time() - filectime($save_root_path))/60)-9; 
    
    if($remote_diff > $refresh){
         //do a refresh

    Is my math right? I dunno what that subtracting of 9 seconds does.

    I’m still puzzling out the next steps but I think the Image Sizer plugin is refreshing everything based on this routine.

  • #5 / Jan 04, 2013 3:41am

    Bhashkar Yadav

    727 posts

    In this plugin doc, you can see it’s having 2 parameters:

    1) base_cache : base cache folder path where you need to store the resized images. If that path is not defined than this plugin will check for “images/” and will store the resized images with “images/sized/”.

    2) cache: you can have yes or no for it (by default on). If you are having “no” then resized images will store within base_cache or with “images/sized”. In you are having “no” then each image will be reprocessed everytime on page load.


    I hope, it would help you.


    Best Regards,

  • #6 / Jan 04, 2013 9:27am

    Peter Smith

    69 posts

    Yup, that’s how it should work.

    But here’s what I learned last night. This only applies if you’re using remote images.

    The plugin was refetching remote images every 24 hours.

    When it is time to display a sized image, it looks at the time stamp on the source image and the timestamp of any sized image in its cache in order to determine if it needs to recreate the sized image. If the time stamp on the source is newer than the timestamp on the sized image in its cache, it recreates the sized image.

    But with remote images, it’s using the timestamp on that local copy and comparing it to the timestamp in its cache. So since it is re-fetching those remote images every 24 hours, the cache-check function thinks it needs to rebuild the sized image once a day.

    As a band-aid solution I set the refetch remote images parameter much higher (to 1000 days).

    At this point I could either re-write Image Sizer or just start using something else.

    I’ve been looking at Pixel Tonics Assets and Causing Effects CE-Image. Would appreciate any input on either of these. We want to get a CDN set up for these sites and so support for CDNs is a bonus. Basically I want to server all our images out of a single domain (we re-use images across this cluster of 6 fairly similar sites).

  • #7 / Jan 04, 2013 1:34pm

    Bhashkar Yadav

    727 posts

    Hi Peter,


    Yes, you are right. This plugin will be refreshing remote images every 24 hours.

    As a band-aid solution I set the refetch remote images parameter much higher (to 1000 days).
    At this point I could either re-write Image Sizer or just start using something else.

    Yes, this solution would be better but there is no need to re-write this plugin. You can just pass “refresh” parameter with image sizer tag. like:

    {exp:imgsizer:size refresh="1440000"}

    1000 days = 1440000 minutes.

    I am hoping it would work.

    Let me know your findings over it.


    Best Regards,

  • #8 / Jan 04, 2013 1:34pm

    Bhashkar Yadav

    727 posts

    if above worked, it would be great.

  • #9 / Jan 04, 2013 1:44pm

    Peter Smith

    69 posts

    Yes, that would work. For our purposes it was easier just to change the default in the plugin rather than go and change the many places we’re calling image sizer, but the refresh parameter is certainly supported.

    It’s quite an adventure, sifting through this code. Another issue is with quality. See these lines:

    $quality = ( ! $this->EE->TMPL->fetch_param('quality')) ? '100' : $this->EE->TMPL->fetch_param('quality');
    $quality = "100";

    That second line needs to be commented out or you’ll get 100% quality all the time.

    Also this line in the ‘build cache location’ section:

    $img['cache_path'] = $this->EE->functions->remove_double_slashes($base_cache.$img['base_rel_path']);

    Seems to be wrong and leads to a cache location of /images/sized/images/sized

    I changed it to:

    $img['cache_path'] = $this->EE->functions->remove_double_slashes($base_cache);

    As per a suggestion over on the read-only devote.ee.com forums.

  • #10 / Jan 04, 2013 11:19pm

    Bhashkar Yadav

    727 posts

    Yes Peter, I also took a glance within image sizer code and it seems that your investigation is great.


    Best Regards,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases