bernhard Posted Tuesday at 08:45 PM Share Posted Tuesday at 08:45 PM This seems to be a fundamental feature so I must be missing something... I have a RockPageBuilder element called "Gallery". I don't think that it matters or RockPageBuilder has anything to do with it, but maybe I'm wrong, so I mention it for completeness. In that gallery block the client can upload images and in my code I create thumbnails from that images and show a gallery like this: Images are output like this: $images->eq(0)->maxSize(800,800)->webp->url Today the client contacted me, that she cropped one image, but the image does not update on the website... I thought I forget the cache busting timestamp, but that's in place and not the issue. Looking into the variations of the image I clearly see the issue: Image #0 and #2 are the newly cropped images. All others are outdated. Any idea why ProcessWire does not recreate those variations? I have done some research and found one old issue by myself that has been closed by @netcarver and I found this module by @Robin S But I'm wondering... am I missing something obvious? Why would I need an additional module to make sure that ProcessWire resets image variations when the underlying original image has been cropped? That makes no sense to me? Thank you very much for your help! Link to comment Share on other sites More sharing options...
Robin S Posted Tuesday at 09:18 PM Share Posted Tuesday at 09:18 PM I'm not sure if it's a solution to your issue, but I have this hook in every site (see the referenced issues for background): // Instead of rebuilding image variations, remove them and they'll be rebuilt when next requested // Fix for: https://github.com/processwire/processwire-issues/issues/1301 // Also see: https://github.com/processwire/processwire-issues/issues/1277 $wire->addHookBefore('Pageimage::rebuildVariations', function(HookEvent $event) { /** @var Pageimage $pageimage */ $pageimage = $event->object; $event->replace = true; $pageimage->removeVariations(); // Return expected output to avoid errors $event->return = [ 'rebuilt' => [], 'skipped' => [], 'reasons' => [], 'errors' => [], ]; }); It's only safe to do this if you do not allow image variations to be directly inserted into RTE fields. More info in this comment: https://github.com/processwire/processwire-issues/issues/1301#issuecomment-893957331 1 Link to comment Share on other sites More sharing options...
bernhard Posted Tuesday at 10:14 PM Author Share Posted Tuesday at 10:14 PM Awesome, thank you! This works perfectly and I have never allowed images in RTE fields, so I'm safe here 🙂 Thx for the note! I have added this as a tweak to RockAdminTweaks: https://github.com/baumrock/RockAdminTweaks/blob/dev/tweaks/General/RemoveVariations/RemoveVariations.php 1 Link to comment Share on other sites More sharing options...
ukyo Posted yesterday at 12:24 AM Share Posted yesterday at 12:24 AM There are some issues about Pageimage class, when creating webp https://github.com/processwire/processwire-issues/issues/2016 https://github.com/processwire/processwire-issues/issues/2048 i don't want to do that :(, i am not using Pageimage class for creating images variations anymore. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now