【发布时间】:2013-04-19 15:16:15
【问题描述】:
这是我正在制作的项目的链接: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);
?>
【问题讨论】:
-
强制浏览器下载...
-
你能告诉我怎么做吗?
-
我用火狐试了一下,图片保存为
picture.php.jpg。 -
@user2021236,DaveRandom 已使用该代码发布了答案 :)