Page 1 of 1

[Solved] Thumbnails BUT they lose there quality, badly.

Posted: Tue Aug 08, 2006 9:47 am
by Dale
Ok I have a site (ain't gonna post the link because it's a rude fetish site) and people upload a picture, and it's staus (in the database) going to pending, which is then when I go into my control panel and accept or deny it. If I accept it then it gets the image from teh directory and makes a thumbnail of it. However the thumbnails come out like really dodgy quality.

Example...

Proper image ( me :p - yes a chav ("UK thing") )
Image

Thumbnail
Image

Notice how dodgy the thumbnail is? Now I used a tutorial on a website to make the thumbnails and this is what I'm using.. any ideas on how to make it better??

Code: Select all

<?php
// *snipped other code*

// Make Thumbnail
$src_img = imagecreatefromjpeg("../pics/$thum_filename");
$origw=imagesx($src_img);
$origh=imagesy($src_img);
$new_w = 100;
$new_h=150;
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "../thumbs/th_$thum_filename", 100);
echo "Image Approved and has been made public. ";
return true;
?>

Posted: Tue Aug 08, 2006 9:56 am
by feyd
imagecreate() :arrow: imagecreatetruecolor()
imagecopyresized() :arrow: imagecopyresampled()

Do some math to get the image into proportions.

Posted: Tue Aug 08, 2006 10:20 am
by Chris Corbyn
:lol: Chav

(They say Charva in Newcastle)

j/k

Posted: Tue Aug 08, 2006 11:23 am
by Dale
d11wtq wrote::lol: Chav

(They say Charva in Newcastle)

j/k
Yeah, as far as I know there is Chav, Scally and Charva. :)





Oh and Cheers feyd! :D