lenoir Posted September 17, 2015 Share Posted September 17, 2015 Thank you anyways. I've tried uploading new images with new names into a new page on a new day with a quality of 10 and still don't see any differences… Seems like this isn't working properly or that i'm doing something wrong. Hope someone else can help? Link to comment Share on other sites More sharing options...
horst Posted September 17, 2015 Share Posted September 17, 2015 Filetype is JPEG you said? If you change things for testing purposes, you can add a param "forceNew" => true to an options array to always override previous versions. And if you want check filesize compared to quality settings you can use the suffix setting for a complete check loop like that: $img = $page->images->first(); // grab you an image (change code to match your setup) $newWidth = ($img->width == 2500) ? 2499 : 2500; // set a width value different than the original image size! (is needed for the test only) $qualities = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10); foreach($qualities as $q) { $options = array('forceNew'=>true, 'quality'=>$q, 'upscaling'=>true, 'sharpening'=>'soft', 'suffix'=>"quality{$q}"); $variation = $img->width($newWidth, $options); echo "<p>variation: {$variation->name} :: " . filesize($variation->filename) . "</p>"; } Code is written in browser, if it doesn't work as expected, please check for typos or come back here and tell me. And if it works, please drop a note about the result. 5 Link to comment Share on other sites More sharing options...
lenoir Posted September 19, 2015 Share Posted September 19, 2015 Hi Horst, Nice bit of code! Tried it out and works nicely. Don't know what I was doing wrong but this helps quite a bit. Thanks a lot! 1 Link to comment Share on other sites More sharing options...
ceberlin Posted May 10, 2016 Share Posted May 10, 2016 A compatibility warning: After testing this with the new Croppable module (which is currently in beta and works with PW3 beta): https://processwire.com/talk/topic/8709-croppableimage/page-7#entry119754 Right now this SpringCleaning module treats crops as "variations" and resets then too! - This is not desired in most cases! 1 Link to comment Share on other sites More sharing options...
horst Posted May 10, 2016 Share Posted May 10, 2016 This is wrong. Maybe it is not desired, but it is how it is designed and how it should behave. Read on here: https://processwire.com/talk/topic/8709-croppableimage/page-7#entry119837 Link to comment Share on other sites More sharing options...
Robin S Posted October 2, 2016 Share Posted October 2, 2016 On 5/10/2014 at 2:28 PM, horst said: I have made a module for you (all). I have had allready a routine that iterates through all pages and clears all imagevariations. But this only can be safely used if you have not used images in RTE's from the same page. If you have done so, those cannot be identified and gets deleted too. So please double check that you do not use Pageimages in your RTE fields before running this module. To run it you have to install it, go to its configscreen and check the box to run it. Also there is a second box, always checked by default, that let the script run in testmode. In testmode it doesn't delete the variations but list all found pages and the images count. So, if you really want to delte all ImageVariations sitewide, tipp the box to run the script, untipp the box to run it in testmode and press the submit button. PageimageRemoveVariations.zip EDIT: better use this enhanced module version from @tpr, with configuration for excluding imagefields: enhanced version! Hi @horst - this module is great and I use it regularly. Only problem is that it causes a deprecated constructor notice in PHP7 (class "filo" has a method "filo" rather than "__construct"). Would you mind updating it? And maybe submit it to the modules directory too? I could update it for my own use but it would be cool to have an "official" version. 1 Link to comment Share on other sites More sharing options...
horst Posted October 2, 2016 Share Posted October 2, 2016 (edited) @Robin S, you should ask @tpr, - he has made the last / enhanced version, if he updates it. EDIT: and if tpr cannot further maintain it, it would be fine if you can do!? (I already have enough modules in the directory, that all need to be maintained) Edited October 2, 2016 by horst Link to comment Share on other sites More sharing options...
Robin S Posted October 2, 2016 Share Posted October 2, 2016 On 16/07/2015 at 0:04 AM, tpr said: Minor fix for a notice right after installing the module (undefined index). Doesn't affect anything. PageimageRemoveVariations_0.0.3.zip Hi @tpr - would you mind updating the module to fix the deprecated constructor? Thanks. 16 hours ago, Robin S said: Hi @horst - this module is great and I use it regularly. Only problem is that it causes a deprecated constructor notice in PHP7 (class "filo" has a method "filo" rather than "__construct"). Would you mind updating it? And maybe submit it to the modules directory too? Link to comment Share on other sites More sharing options...
tpr Posted October 3, 2016 Share Posted October 3, 2016 Here is it - if it works fine I can upload it to github/modules dir. PageimageRemoveVariations_v004.zip 2 Link to comment Share on other sites More sharing options...
Robin S Posted October 4, 2016 Share Posted October 4, 2016 On 4/10/2016 at 1:41 AM, tpr said: if it works fine I can upload it to github/modules dir It works perfectly, thanks! 1 Link to comment Share on other sites More sharing options...
tpr Posted October 26, 2016 Share Posted October 26, 2016 On GitHub: https://github.com/rolandtoth/PageimageRemoveVariations On Modules directory: http://modules.processwire.com/modules/pageimage-remove-variations/ 3 Link to comment Share on other sites More sharing options...
ceberlin Posted October 30, 2016 Share Posted October 30, 2016 The update throws an error here on PW 3.0.39 (a problem with namespace?): 79: require_once(\ProcessWire\wire('files')->compile(dirname(\ProcessWire\wire("config")->paths->root . 'site/modules/PageimageRemoveVariations/PageimageRemoveVariations.module') . '/PageimageRemoveVariationsConfig.php',array('includes'=>true,'namespace'=>true,'modules'=>false,'skipIfNamespace'=>false))); 80: $c = new \ProcessWire\PageimageRemoveVariationsConfig(); Link to comment Share on other sites More sharing options...
ceberlin Posted October 30, 2016 Share Posted October 30, 2016 ...was a filecompiler issue - on several sites... deleting the compiler cache manually fixed it. 1 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