画像にテキストを追加し、php で gd を使用してさまざまなサイズで表示しようとしています。1つの画像を表示する方法を知っています。これがコードです。
<?php
if (!isset($_FILES['image']['tmp_name'])) {
}
else{
$file=$_FILES['image']['tmp_name'];
$img_src = imagecreatefromstring(file_get_contents($file));
$img_dest = imagecreatetruecolor(100, 100);
$src_width = imagesx($img_src);
$src_height = imagesy($img_src);
imagecopyresized($img_dest, $img_src, 0, 0, 0, 0, 100, 100, $src_width, $src_height);
$text = $_POST['text'];
$font_path = 'arial.TTF';
$black = imagecolorallocate($img_dest, 0, 0, 0);
imagettftext($img_dest, 25, 0, 302, 62, $grey, $font_path, $text);
imagettftext($img_dest, 20, 0, 10, 20, $black, $font_path, $text);
header( "Content-type: image/png" );
imagepng( $img_dest );
imagedestroy( $img_dest );
imagedestroy( $img_src );
}
?>
しかし、同じページに同じ画像を異なるサイズで複数表示するにはどうすればよいですか
これを行う方法を教えてください。