0

I have an "Images" Upload Destination where I have specified Maximum Image Width (in pixels) as 1400. But sometimes, I'd guess 50%, the image ends up at 1401. Any idea why?

What happens is a user uploads a file, I constrain the width to 1400 with that setting, then I tell them to go Edit Image / Crop Mode and crop it to 479. (I don't do this automatically because it could result in bad crops.) It's easier if they can make their box at full width then pull it down to 479 rather than carefully setting both x and y.

1

This was evidently a bug in EE and will be patched in the next version (past 2.8.1). For now, the solution is:

In system/expressionengine/libraries/Filemanager.php around line 508:

if (($force_master_dim == 'height' && $prefs['height'] < $prefs['max_height']) OR
                ($force_master_dim == 'width' && $prefs['width'] < $prefs['max_width']) OR
                ($force_master_dim == FALSE && $prefs['width'] < $prefs['max_width']) OR
                ($force_master_dim == FALSE && $prefs['height'] < $prefs['max_height'])) 

Instead of < it needs to be <= a la:

if (($force_master_dim == 'height' && $prefs['height'] <= $prefs['max_height']) OR
                ($force_master_dim == 'width' && $prefs['width'] <= $prefs['max_width']) OR
                ($force_master_dim == FALSE && $prefs['width'] <= $prefs['max_width']) OR
                ($force_master_dim == FALSE && $prefs['height'] <= $prefs['max_height'])) 

Retrieved from https://support.ellislab.com/bugs/detail/20292.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.