Hey
The script works, but the result.. the Thumbnail, gets kinda ugly. It's not like when you resize it in Photoshop. I've attached what the thumbnail looks like.
I want it to be a smooth picture. Not all edgy like that.
What should I do?
It's something wrong with your code. Try looking at this example.
same exact code pretty much. All tags he ahve for creating the picture is in my code.
I've also tried both the GDlib2.0 version and GDlib 1.x..
Using Apache on Windows (XP) machine. PHP v4.3.1.
okay, I lied.. but when I used
imageCreateTrueColor
it doesn't work with GDlib1.x reason I use v1.x is that when I use v2.x of GDlib the image gets really weak in color.
Maybe it depends on how GDlib is compiled?
But I haven't touched it. It came as is, with the Apache installation.
It shouldn't matter how it's compiled. I, also, use GD 1, so that's not the problem.
Are you using imagecopyresized?
Ah! hey.. guess what I "figured out".. it doesn't actually resize the picture using and compression at all.
it is using the 640x480 picture and just schrinking it.. like you can with a normal <IMG> tag. So to find that out I just took the original file and schrunk it down with <img src="file.jpg" width=110>.... the result was the exact same as with the thumbnailing script.
So how do you fix that?
This is the code I have:
if (@!$max_width) $max_width = 110; if (@!$max_height) $max_height = 200; $file = "onayacht.jpg"; $size = GetImageSize($file); $width = $size[0]; $height = $size[1]; $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if ( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $src = ImageCreateFromJpeg($file); $dst = imageCreateTrueColor($tn_width,$tn_height); ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height); header("Content-type: image/jpeg"); Imagejpeg($dst,'',100); //to print to screen ImageDestroy($src); ImageDestroy($dst);
if (@!$max_width) $max_width = 110; if (@!$max_height) $max_height = 200;
$file = "onayacht.jpg"; $size = GetImageSize($file); $width = $size[0]; $height = $size[1]; $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if ( ($width <= $max_width) && ($height <= $max_height) ) { $tn_width = $width; $tn_height = $height; } else if (($x_ratio * $height) < $max_height) { $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; } else { $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $src = ImageCreateFromJpeg($file); $dst = imageCreateTrueColor($tn_width,$tn_height); ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height); header("Content-type: image/jpeg");
Imagejpeg($dst,'',100); //to print to screen ImageDestroy($src); ImageDestroy($dst);
I'd test it, but I use GD 1. I don't have the ability to use imagecreatetruecolor(), so I can't use it.
It looks like it should work, though.
can you send me your gdlib.dll?
http://www.boutell.com/gd/http/gd-1.8.4.zip
dear cyber friend,
I can't compile it.
Will ImageMagick work with Apache Win32?
can you show me a website that uses GDlib to make thumbnails... successfully? I need to see if it actually works.
The few in the example I showed you should all work.
what I ment to say was that can you show me a website that uses gdlib to make thumbnails.. and where the thumbnails comes out clean!
This is what I want my thumbnails to be like: http://www.r1-forum.com/pictures ... but htat site uses ImageMagick.