ディレクトリ内のすべての画像を調べ、幅をチェックし、この幅でない場合はサイズを変更する小さなスクリプトを作成しています。
私がこれまでに持っているのはこれです:
$files = glob("*.{png,jpg,jpeg}", GLOB_BRACE);
foreach ($files as $file)
{
// get the image size
$imagesize = getimagesize($file);
$width_orig = $imagesize[0];
$height_orig = $imagesize[1];
$dst_w = 900;
if($width_orig != $dst_w)
{
$dst_h_multiplier = $dst_w / $width_orig;
$dst_h = $dst_h_multiplier * $height_orig;
$dst = imagecreatetruecolor($dst_w, $dst_h);
$image = imagecreatefromjpeg($file);
imagecopyresampled($dst, $image, 0, 0, 0, 0, $dst_w, $dst_h ,$width_orig, $height_orig);
imagejpeg($dst,null,100);
}
}
スクリプトは正常に実行されているように見えますが、このスクリプトが実行されているのと同じディレクトリ内の画像ファイルは変更されていません。
ここで何が欠けていますか?どうすればこれをデバッグできますか?