views:

19

answers:

2

Hi,

My code below creates the thumb but it is pretty grainy and although not black and white looks pretty washed out.

Any ideas how I can create a better quality thumb?

$thumb = $targetPath."Thumbs/".$fileName;

$image = imagecreatefromjpeg($targetFile);
$width = 200; //New width of image    
$height = 92; //This maintains proportions

$thumbWidth = 200; 
$thumbHeight = 92;

$sourceImage = imagecreatefromjpeg($targetFile);

$targetImage = imagecreate($thumbWidth,$thumbHeight);
 imagecopyresampled($targetImage,$sourceImage,0,0,0,0,$thumbWidth,$thumbHeight,imagesx($sourceImage),imagesy($sourceImage));

//imagejpeg($targetImage, "$thumbPath/$thumbName");
imagejpeg($targetImage, $thumb, 100);

chmod($thumb, 0755)

;

thanks R.

A: 

use imagick, it will give way better results http://lt.php.net/manual/en/function.imagick-thumbnailimage.php

GameBit
thanks for your answers, imagick worked for me.
Roscoeh
A: 

Use this: ini_set("gd.jpeg_ignore_warning", 1);

Stewie