• I am up against a wall. The client has been adding custom crops as we’ve been finishing up development, but regenerating thumbnails (something we HAVE to do before launching) will clear all of the crops they’ve made.

    Am I missing something? Regenerating thumbnails is a really standard WordPress thing-to-do but from what I can tell there’s absolutely no way to do this and not have it completely invalidate this plugin.

    If the answer is no, is there maybe a way to call the cropping function programmatically for a particular image / image size combination? I could see putting together a workaround if I could at least figure that part out.

    Thanks to whoever takes the time to read this 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter martinparets

    (@martinparets)

    Alright – in an act of desperation I forked the “Force Regenerate Thumbnails” plugin so that it…

    1. Does not overwrite custom crop image metadata
    2. Regenerates thumbnails based on custom crop when set
    3. Regenerates RETINA thumbnails based on custom crop when set
    4. Generates RETINA thumbnails after saving a new custom crop using WP admin

    If it works in production without issue, I’ll come back and post my solution for other poor, unfortunate souls that are stuck where I was.

    luther

    (@lutheradams)

    Hi @martinparets , I am in the same boat as you at the moment. We occasionally have to regenerate thumbnails across multiple sites and when we do we lose all our saved cropped images. This can sometimes take more than a day to re crop all the images again.

    I would be interested in seeing your solution with the forked plugin.

    Thank you.

    • This reply was modified 4 years, 3 months ago by luther.
    Thread Starter martinparets

    (@martinparets)

    Hey @lutheradams

    Surely. Here’s a ZIP:
    https://drive.google.com/file/d/1-YWIFWM8BuHEeFXGsTXKKanhpEmMlrTr/view?usp=sharing

    We are running this on production and despite heavy use we haven’t had any issues so far. A few notes for you:

    1. I marked where our hacks are. They start on line 651 and stop on line 734.
    2. We’re using the “Perfect Images Pro” plugin for retina. If you are NOT using this plugin, I think you can remove lines 710-730.
    3. If you ARE using “Perfect Images Pro”, you’ll need some additional code in functions.php that re-generates retina thumbnails when an image is custom-cropped. Without this, retina thumbnails will not show your custom crops. I’ve added a file to the ZIP called bonus-snippet.php that contains the necessary code.

    Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Is there no way to preserve custom crops after regenerating thumbnails?’ is closed to new replies.