我的代码创建了拇指,但它非常颗粒状,虽然不是黑色和白色看起来很漂亮。
我有什么想法可以创造出质量更好的拇指吗?
$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。
答案 0 :(得分:0)
使用imagick,它会让结果更好http://lt.php.net/manual/en/function.imagick-thumbnailimage.php
答案 1 :(得分:0)
使用:ini_set(“gd.jpeg_ignore_warning”,1);