imagemagick の機能 'thumbnailImage' を使用して画像のサイズを変更しようとしています。今のところ、後で画像を操作することはなく、新しい寸法をエコーして機能するかどうかを確認するだけです。そして、これまでのところ、それは機能していません。これが私のコードです。注: 新しい寸法ではなく、元の寸法が反映されます。
$image = $_FILES["file"]["tmp_name"];
//Get original dimensions
list($width, $height, $type, $attr) = getimagesize($image);
echo "<BR>";
echo "ORIGINAL:";
echo "<BR>";
echo "Image width $width";
echo "<BR>";
echo "Image height " .$height;
$max_height = 200;
$max_width = 150;
function thumbnail($image, $max_width, $max_height) {
$img = new Imagick($image);
$img->thumbnailImage($max_width, $max_height, TRUE);
return $img;
}
thumbnail($image, $max_width, $max_height);
//get new dimensions
list($width, $height, $type, $attr) = getimagesize($img);
echo "<BR>";
echo "NEW:";
echo "<BR>";
echo "Image width $width";
echo "<BR>";
echo "Image height " .$height;
エコーの 2 番目のセットも表示されません。現在、エラーがあります。