php thumbnail - 创建一个颗粒状的黑白图像

时间:2010-09-26 18:21:23

标签: php image thumbnails

我的代码创建了拇指,但它非常颗粒状,虽然不是黑色和白色看起来很漂亮。

我有什么想法可以创造出质量更好的拇指吗?

$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)

谢谢R。

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

使用:ini_set(“gd.jpeg_ignore_warning”,1);