You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
When attempting to resize and crop to exact dimensions, some dimensions/ratios result in an imperfect crop.
For instance, /slir/w960-h350-c960x350/path/to/image.jpg results in an image that is 960 x 349 pixels. Is there a way to achieve an exact crop to the specified dimensions?
The text was updated successfully, but these errors were encountered:
I made a provisional patch in order to fix my scenario...
On the slir.class.php
I have replaced the line 950 on the else of resizeCroppedHeightFactor:
return $this->getRequest()->height / $this->getSource()->getCropHeight(); // Original Line of code
With this preliminar code (i don't recommend using this in production):
# Do the standard calculation using Height to determine factor
$factor = $this->getRequest()->height / $this->getSource()->getCropHeight();
# Then i try to calulate the final size of the picture with the original factor
$newHeigth=round($factor * $this->getSource()->getCropWidth());
# If the new size is different that i have set on the request i do the calculation using Width instead
if($newHeigth!=$this->getRequest()->height){
$newFactor = $this->getRequest()->width / $this->getSource()->getCropWidth();
$factor = $newFactor;
}
return $factor;
This code may break other things.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When attempting to resize and crop to exact dimensions, some dimensions/ratios result in an imperfect crop.
For instance, /slir/w960-h350-c960x350/path/to/image.jpg results in an image that is 960 x 349 pixels. Is there a way to achieve an exact crop to the specified dimensions?
The text was updated successfully, but these errors were encountered: