PHPとGDを用いて画像を縮小させる場合

PHPとGDを用いて画像を縮小させる場合、使う関数を間違えると汚い画像になってしまうので、
サンプルコードは以下の通り。

$src = @imagecreatefromjpeg(元画像ファイルパス);

$dst_width = 縮小後の横幅;

$point = $dst_width / $width;

$dst_height = $height * $point;

$dst = imagecreatetruecolor( $dst_width, $dst_height );

//imagecopyresized($dst, $src, 0,0,0,0,$dst_width, $dst_height ,$width,$height);
imagecopyresampled($dst, $src, 0,0,0,0,$dst_width, $dst_height ,$width,$height);
imagejpeg($dst,結果として出力するファイルパス);

上記サンプルコードで重要なのは、
imagecopuresized
ではなく、
imagecopyresampled
を使う点。これだけでもだいぶ変わる。