Hi @andersthorborg
Thank you for quickly fixing this issue for us. Much appreciated.
A few issue that we’ve spotted…
Force user to crop
Can’t really see this doing anything. I can still add an image, and publish the page with out cropping the image. What is meant to happen here?
Save cropped image to media library = yes & Return = Image object
This actually does not seem to create a new media library item anymore? And this is what is returned as the image object…
stdClass Object
(
[image] => 2014/07/GSX-RL4_action_1_646x340_acf_cropped.jpg
[preview] => 2014/07/preview_GSX-RL4_action_1_646x340_acf_cropped.jpg
)
So I’m guessing its a little broken, but it works but we need to work a little differently.
—-
This is how I think it should work. Please hear me out…
Save cropped image to media library
Rename this to…
Save cropped image as new media library item
If is ‘NO‘ get the image URL of the target image, use this image and delete using unlink(‘$target_img) and then save the new cropped version with exactly the same name. Do not add _acf_cropped into the file.
Also please note you are using an underscore before the dimensions in your image filename, wordpress uses a hyphen just before the image dimensions rather than a underscore.
This means, we can use the Image URL, Image ID and Image Object. No need to disable Image ID and Image Object this way ??
And this is better because you are updated the original media library item. But you are only ever updating the target size. Which is great because this allows the user to have different cropped sizes for all their images sizes, all in the original media item. In turn allowing us to use the Image Object and Image ID.
If is ‘YES‘ then this should just create a new media library item just for this target image size. Just like it did in version 4. And you can add _acf_cropped into the file name for this version so it does interfere with original media item.
—-
We tried to implement this ourselves. But we didn’t test the plugin thoroughly enough before we started modifying the plugin, then released the plugin does not create a new media item anymore, so we were struggling to get the whole thing bug free.
Many Thanks