Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

Blog add-on recreates featured images

Home Forums Support Blog add-on recreates featured images

  • This topic has 7 replies, 3 voices, and was last updated 5 years ago by Tom.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #150265
    Shane

    I’m the developer of the EWWW Image Optimizer, and one of my users was having a problem with images being regenerated repeatedly, and we finally narrowed it down to the Blog add-on for GeneratePress. The function claims that it will serve an existing image or create a new one, save it to disk, and then serve that. The reality is that every single page load triggers creating a new image, saving it to disk, and then serving it.

    In perusing the code, the reason is that gambit_otf_regen_thumbs_media_downsize() does something entirely different depending on whether $size is a string or an array. In my testing, $size = ‘generate-plus’ (a string), and that section of code never checks to see if the file actually exists.

    I’m sure folks would appreciate a bugfix on that, as regenerating every featured image on every page load would certainly cause extra load on a server, and reduce page loading speed as well.

    #150273
    Tom
    Lead Developer
    Lead Developer

    Hi Shane,

    Thanks for bringing this to my attention – I really appreciate it.

    I’ll check to see if it’s something on my end that needs tweaking or if it’s within the resizing script itself (https://github.com/gambitph/WP-OTF-Regenerate-Thumbnails).

    If you’re aware of any other on the fly WP resizers – I’m all ears!

    Thanks again 🙂

    #150569
    Fotios Nisiropoulos

    Hi Shane, Hi Tom,

    thank you so much for taking care for that problem!
    I hope that you find a fix for my issue, as it drove me crazy for a few weeks.

    If you need some testing of the fix from my side then just drop me a note.

    Thanks,
    Fotios

    #150746
    Tom
    Lead Developer
    Lead Developer

    I believe this is a bug with the actual script: https://github.com/gambitph/WP-OTF-Regenerate-Thumbnails

    I’ve looked into how we’ve implemented it and can’t see anything I can do any different.

    I’ll look around for an alternative image resizer.

    #150747
    Shane

    Or you could just add in a check to the file_exists() function with the image filename before it actually generates the resize in that code block.

    #150765
    Tom
    Lead Developer
    Lead Developer

    Add that check into the otf_regen_thumbs.php file? I’ve checked though the file and it does seem to check to see if the image exists before generating it, although it doesn’t use the file_exists() function like it does if the size is an array.

    Maybe it would be best if I just served the sizes as an array instead of a string – that way I don’t need to touch the script.

    How did you test to see if the script was re-creating the image on every load?

    #150835
    Shane

    Yeah, now that you mention it, it probably would be easier to just pass in an array with the dimensions. The filename doesn’t really exist as a variable prior to the resize function in the other section of the code, so you’d have to find a way to figure out what the name is GOING to be before you can even check to see if it already exists.

    I tested it via a debugging function I have in EWWW Image Optimizer, just added a couple extra lines in on my local dev install of WP, and then I could see that every time I refreshed the page, it was sending an image through the WP_Image_Editor functions that EWWW hooks into.

    #150862
    Tom
    Lead Developer
    Lead Developer

    I’ve gone ahead and made the adjustments to call the resizer using an array instead of a string – hopefully it fixes it.

    If you want to give it a test just let me know at support@generatepress.com and I’ll send it your way.

    Either way, I appreciate the heads up! 🙂

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.