これは私が作っているプロジェクトへのリンクです: http://1-to-n.com/ik/
何でも入力して送信を押すだけで、次のページに移動して画像にテキストが表示されます。すべてがうまく機能していますが、画像を右クリックして保存しようとすると、拡張子が「picture.php.jpe」のように変です。
画像生成ページのコードは次のとおりです。
<?php
//Set the Content Type
header('Content-type: image/jpeg');
// Create Image From Existing File
$jpg_image = imagecreatefromjpeg('vote.jpg');
// Allocate A Color For The Text
$white = imagecolorallocate($jpg_image, 47, 45, 46);
// Set Path to Font File
$font_path = 'MISTRAL.TTF';
// Set Text to Be Printed On Image
$text = $_POST['name'];
// Print Text On Image
imagettftext($jpg_image, 75, 0, 500, 130, $white, $font_path, $text);
// Send Image to Browser
imagejpeg($jpg_image);
// Clear Memory
imagedestroy($jpg_image);
?>