以下のコードは、イメージを50 * 50にサイズ変更しますが、データベースのイメージ名を選択して、これらの$ filename = 'folder/$ imagename'のように置きます。それはどのように私はこれらを修正することはできません動作しません。ただ、一つの小さな問題イメージフォームの日付ベースを選択してサイズを変更します
<?php
$filename = 'folder/Aizen.jpg';
$width = 50;
$height = 50;
header('Content-type: image/jpeg');
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p, null, 100);
?>
<img src="<?= $filename ?>" alt="" />
エラーをご覧くださいか? – madmik3
"動作しません"と定義する必要があります –
"動作しません"というのは非常に冗長なエラー記述ではありません。パス "folders/..."の画像が存在しない可能性がありますか?多分あなたはパスを調整する必要がありますか? – schneck