Welcome to WebmasterWorld Guest from 100.26.182.28

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

phpthumb strange black line appearing occasionally

     
11:26 pm on Feb 17, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 7, 2007
posts: 188
votes: 0


I use phpthumb in a basic cms I set up for my client but every now and again it add a 1 pixel horizontal black line to the bottom of the image? I've tried re-uploading it but still the same weird problem.

Any ideas?

5:19 pm on Feb 18, 2009 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
posts:3416
votes: 0


Probably a rounding error in the resizing math. The example code on the imagecopyresampled manual page [php.net] even has the error... Basically, when you create the image it always uses an integer width and height, but when you resize one image buffer into another, you can actually provide float/decimal width and heights.

Just use ceil() when appropriate... you'll end up "losing" a row or column of pixels here or there, but that's better than the mysterious black line. :)

5:44 pm on Feb 20, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 7, 2007
posts: 188
votes: 0


Hi, thanks for replying - can you please let me know how to use the ceil() code you mentioned? I'm currently using this to bring in the image using phpthumb:

<img src="../phpthumb.php?src=cms/[image]&q=60&wl=640&hp=500">

7:10 pm on Feb 21, 2009 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
posts:3416
votes: 0


You would need to look in the source code of phpthumb.php to find where it handles resizing.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members