• Resolved codemonkeynorth

    (@codemonkeynorth)


    Hi,

    we have a lot of media on our site (several thousand) and are looking to optimize the library with EWWW.

    Currently the site creates -scaled.jpg versions at the default 2560when we upload larger images. We want to set a new max size of 2048 and apply this to both new images and old images.

    Out of a few thousand posts, we have 427 posts that use these -scaled.jpg versions

    EWWW lets us set a maximum width/height.
    WordPress lets us also set a maximum threshold usingadd_filter('big_image_size_threshold', ......
    and remove the 2048x2048 and 2560x2560 sizes using eg remove_image_size('2048x2048') or filtering on intermediate_image_sizes_advanced

    When I tried to combine these I ended up breaking the image. The -scaled.jpg version became the new “original” on the attachment screen – (even though the original is still on disk)… I couldn’t get it to show this:

    File name: original-scaled.jpg
    Original: original.jpg (this part disappeared)`

    ie it loses the connection to the original image… meaning thumbnails now got regenerated as original-scaled-150x150.jpg etc rather than original-150x150.jpg etc

    I think messing with the max image size threshold confused it when running “Regenerate Thumbnails” plugin

    Again we are just trying to reduce the original.jpg version to 2048×2048 max on upload. There would be no reason for the original-scaled.jpg version presumably at this point, but since they are 427 posts with -scaled versions attached, it would see we can’t just remove the scaled versions entirely.

    Is there a way to run EWWW & Regenerate Thumbnails in a way that

    1) resizes all originals to 2048x2048 max
    2) understands pointing the -scaled (default 2560x2560 max) versions already attached to posts back to the original image which should now be 2048x2048max

    thanks
    J.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    Posting my email reply, in case someone has the same question in the future:

    From what I understand, you only want to have a 2048 version, and want to get rid of the originals, right? And of course, you want to do so without breaking existing posts that may link to my-image-scaled.jpg I would guess ??

    Fortunately, EWWW IO can do that just fine, without using any core filters. Notably, you’ll need to enable the Resize Existing option on the Resize tab–enable Ludicrous Mode first.
    EWWW IO will apply the 2048×2048 restriction to the image named my-image-scaled.jpg, and then you can remove the originals via Tools->EWWW Image Optimizer->Delete Originals

    As you mentioned, any thumbnails on the affected images will be generated from the -scaled image, so that’s potentially problematic, but I don’t know any way to get around that. EWWW IO doesn’t rename the -scaled version after you delete the originals, since if you have existing posts linking to the full-size image, those would break.
    So I’m afraid there’s likely to be some tedious image/link checking if you regenerate thumbnails on those images after removing the originals.

    Hope that helps to clarify!

    Thread Starter codemonkeynorth

    (@codemonkeynorth)

    Thanks… yes I need to be able to regenerate thumbnails later from the originals so deleting originals probably doesn’t work for this

    I think I did find a way with some filters and another plugin to make it so it essentially sees the scaled & optimised version as the new original (but still with the filename -scaled.jpg), but I’ll need to double check all the references in the database.

    Will post my solution if I find one!

    Plugin Author nosilver4u

    (@nosilver4u)

    Oh, and I forgot to mention, you might try the Force Regenerate Thumbnails plugin. Naturally, it removes ALL thumbnails, so it might not be quite what you want, but it does properly handle generating thumbs from the actual original image–I fixed that bug in the plugin late last year when we adopted it.

    Thread Starter codemonkeynorth

    (@codemonkeynorth)

    just to clarify for anyone reading through… really i was looking to go from this:

    original.jpg (4000×4000)
    original-scaled.jpg (2560×2560)
    original-768x768.jpg (other small sizes etc)

    to this:

    original.jpg (2048×2048)
    (scaled version not necessary here)
    original-768x768.jpg (other smaller sizes etc)

    and then have it so the posts point to the optimised original again, rather than the scaled version.

    currently my posts point to the scaled version – which show an extra reference back to the original in the db. Whatever does the optimisation would need to know to point the reference back to the original especially if the scaled version gets removed by the process.

    maybe it’s possible to do all this optimsation/conversion of the original by using the scaled version, resizing that, renaming the file on the server, updating the db references, then generating the thumbnails again.. but with several hundred/thousand media it’s a bit of a pain to do it manually!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘setting a new max size for existing -scaled images and optimising’ is closed to new replies.