Strange Image Thumbnail Display in Editor

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 30, 2011   (RSS)

By gkornbluth - July 29, 2011

Hi All,

Anyone have an idea why if I upload a tall skinny .jpg (10px x 500px) that I'm using as a page background gradient, instead of a small thumbnail displayed in my editor upload field I get a really tall thumbnail and have to scroll the thumbnail to see the bottom of it (or the “remove” link)?

I’ve tried reducing the mandatory “re-size if larger than” and creating really small thumbnail sizes and the uploaded image and thumbnail sizes do in fact change, but nothing changes in the editor display.

I've tested the issue in V2.09 through 2.11 with single record and multi-record editors with the same result.

I've uploaded a sample jpg

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Strange Image Thumbnail Display in Editor

By Jason - July 30, 2011

Hi Jerry,

The reason for this is that the image CMS Builder displays inside the record editor comes from a function called showUploadPreview().

In this function, a width for the preview image is set. This has been hardcoded to use a width of 50 in the function call. So if your image has dimensions of 10 X 500, it has an aspect ratio of 1:50. So if the preview image is given a width of 50, it has a height of 2500!

If you want to override this to use the thumbnail width, here is some code to do this. Please note that I only tried this change in version 2.11 and if you upgrade your installation, this change would be overwritten.

Open up cmsAdmin/lib/menus/default/uploadList.php. On line 98 you should see this:

<?php showUploadPreview($row, 50); ?>

You can make this change to it:

<?php

$width = 50;
if ($row['isImage'] && $row['hasThumbnail']) {
$width = $row['thumbWidth'];
}
?>
<?php showUploadPreview($row, $width); ?>


this will use the images first thumbnail width. If a thumbnail doesn't exist, it will default back to 50.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Strange Image Thumbnail Display in Editor

By gkornbluth - July 30, 2011

Thanks Jason,

I'll give it a try.

Any chance you could make this permanent in the next version?

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php