forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: neil fitzgerald on April 25, 2009, 03:20:50 am

Title: Blurry thumbnails - incorrect dimensions
Post by: neil fitzgerald on April 25, 2009, 03:20:50 am
This issue seems to have resurfaced. http://forum.coppermine-gallery.net/index.php?topic=53320.0 (http://forum.coppermine-gallery.net/index.php?topic=53320.0)
Some (but not all) thumbnails are getting incorrect dimensions from Coppermine (e.g. 99x150px in the HTML, when I have made them all myself at 100x150).

My site: http://www.neilfitzgeraldphoto.co.nz/gallery/thumbnails.php?album=lastup&cat=0 (http://www.neilfitzgeraldphoto.co.nz/gallery/thumbnails.php?album=lastup&cat=0), currently cpg 1.4.21.

Suggestions appreciated very much.
Neil.
Title: Re: Blurry thumbnails - incorrect dimensions
Post by: neil fitzgerald on April 30, 2009, 01:08:28 am
Is nobody else experiencing this problem?
Title: Re: Blurry thumbnails - incorrect dimensions
Post by: Joe Carver on April 30, 2009, 01:23:32 am
The answer is in the original post
EDIT: Looks like there were changes in the 3.x line (http://www.actsofvolition.com/archives/2006/december/scalingimages).  Hmm...  Regardless, this appears to be a Firefox "problem" and not Coppermine.

EDIT2: After some Googling, turns out the FF 3.x line switched to the Cairo graphics library


Are you concerned about the size only?  What image converter have you selected and what about the quality you have set in admin? Have you tried changing those settings? Have your tried the resizing tool in the admin menu? Or...did you resize and rename these and upload them as _thumbs? Run the version check to make sure your functions.inc.php got the upgrade too, because the code change mentioned in that post is in the newest version.


p.s. It does seem to be an artifact only on FF and SeaMonkey they weren't resized in Opera and IE. And yes, some of my thumbs are also showing the same behavior in FF but I can't see the difference until I look at the properties  :)
Title: Re: Blurry thumbnails - incorrect dimensions
Post by: neil fitzgerald on May 03, 2009, 11:28:13 am
It is not a problem only with FF, as was concluded at the end of that thread I linked to. It is obvious in FF because it seems to do a poor job of the resize. FF (3), IE (6,7, 8), and Safari all suffer. The source code read by all of these is telling the browsers to draw the thumbnails 99x150 px, when they are actually 100x150, so it is not the fault of any browser. I made them 100x150 in photoshop and uploaded them myself. If you save a thumbnail off my site and check the dimensions locally you will see it is 100x150, not 99x150 as coppermine is telling browsers. That 1 px makes a big difference.

Versioncheck suggests all is ok. I even downloaded functions.inc.php from my site to manually check the code was still the same.

Title: Re: Blurry thumbnails - incorrect dimensions
Post by: Stramm on May 03, 2009, 12:43:42 pm
instead of (compare the thread you quoted)
Code: [Select]
        $image_size['width'] =  (int) ($width / $ratio);
        $image_size['height'] = (int) ($height / $ratio);
try
Code: [Select]
        $image_size['width'] =  round ($width / $ratio);
        $image_size['height'] = round ($height / $ratio);

The initial ceil solution always returned the next highest integer value, so if width/ ratio is eg. 99.3, it resulted in 100 when the desired return vale is 99. Using int always cuts off everything after the dot. In your case 99.9 becomes 99. Not the desired value we need. Using round does a true round. 99.3 results in 99, 99.9 (your case) will become 100. So I think that should be a good solution in most environments.
Title: Re: Blurry thumbnails - incorrect dimensions
Post by: neil fitzgerald on May 04, 2009, 10:22:20 am
That's fixed it, and I've learnt a little of php!
Thank you!! ;D