Blurry thumbnails - incorrect dimensions Blurry thumbnails - incorrect dimensions
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Blurry thumbnails - incorrect dimensions

Started by neil fitzgerald, April 25, 2009, 03:20:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neil fitzgerald

This issue seems to have resurfaced. 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, currently cpg 1.4.21.

Suggestions appreciated very much.
Neil.

neil fitzgerald

Is nobody else experiencing this problem?

Joe Carver

#2
The answer is in the original post
Quote from: pharaohweb on June 18, 2008, 06:21:00 PMEDIT: 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  :)

neil fitzgerald

#3
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.


Stramm

instead of (compare the thread you quoted)
        $image_size['width'] =  (int) ($width / $ratio);
        $image_size['height'] = (int) ($height / $ratio);

try
        $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.

neil fitzgerald

That's fixed it, and I've learnt a little of php!
Thank you!! ;D