1

phpThumb (またはその他の画像サイズ変更ライブラリ) で親指を生成する際に大きな問題があります。

最初に目に見える問題をお見せしましょう: http://aep.w3mt.biz/content/mediacontent/products/427/aztec-pearls-1.jpg_gz.jpg (これは生成された画像です) http://aep.w3mt .biz/content/mediacontent/products/427/aztec-pearls-1.jpg (ソース画像です)

ご覧のとおり、画像はより大きく、php サム、100% 品質、塗りつぶし色によって生成されています。

ソース画像の背景は真っ白ですが、生成された画像の背景には #fefefe 横縞があります。これは非常にクリアなディスプレイでは目立ち、非常に煩わしいものです。

誰かがこの問題を抱えていたのか、このバグの解決策があるのか​​ 疑問に思っています.

生成されるその他のサイズ:

前もって感謝します!

4

1 に答える 1

0

サムネイルを生成する方法は次のとおりです。ぜひお試しください。

header("Content-type: image/jpeg");
$collection = $_GET['collection'];
$ref        = $_GET['ref'];
$maxthumb=100;
$filename=DirectoryNameFromCollectionNumber($collection) . "/" . $ref . ".jpg";
$size = getimagesize($filename);
$ratio = $size[0]/$size[1]; // width/height
if( $ratio > 1) {
    $width = $maxthumb;
    $height = $maxthumb/$ratio;
}
else {
    $width = $maxthumb*$ratio;
    $height = $maxthumb;
}
$src = imagecreatefromstring(file_get_contents($filename));
$dst = imagecreatetruecolor($width,$height);
imagecopyresampled($dst,$src,0,0,0,0,$width,$height,$size[0],$size[1]);
imagedestroy($src);
imagejpeg($dst);
imagedestroy($dst);
于 2014-05-09T08:32:59.817 に答える