Preview in file upload control does not scale down perfectly square images
--------------------------------------------------------------------------
Key: MAGNOLIA-3734
URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3734
Project: Magnolia
Issue Type: Bug
Components: admininterface, gui, templating
Affects Versions: 4.4.4
Reporter: Tobias Mattsson
Assignee: Philipp Bärfuss
Attachments: square_image.jpg
When the image is perfectly square, like 600x600, its not scaled to fit inside
the 150x150 area that the preview should fit into. The code is this, in
DialogFile.java:
{code}
// resize if to big
if(imgwidth > imgheight && imgwidth > 150){
imgheight = (int)(150.0/imgwidth * imgheight);
imgwidth = 150;
}
else if(imgheight > imgwidth && imgheight > 150){
imgwidth = (int)(150.0/imgheight * imgwidth);
imgheight = 150;
}
{code}
It should be fixable by changing to:
{code}
// resize if to big
if(imgwidth == imgheight && imgwidth > 150){
imgwidth = 150;
imgheight = 150;
} else if(imgwidth > imgheight && imgwidth > 150){
imgheight = (int)(150.0/imgwidth * imgheight);
imgwidth = 150;
}
else if(imgheight > imgwidth && imgheight > 150){
imgwidth = (int)(150.0/imgheight * imgwidth);
imgheight = 150;
}
{code}
I've attached an image that can be used to demonstrate the problem.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------