我有一个php页面,它检索远程图像的完整url,然后它必须显示它。但即时通讯错误“无法显示,因为它包含错误”。我需要这个脚本的应用程序。有人可以在这里指出错误吗?PHP图像标题错误,获取无法显示,因为它包含错误?
该网址工作完美,因为当我回显网址..它正确回应它。所以即时通讯假设错误是在图像标题或什么的。请帮忙。
请注意,数据库存储JPEG的文件名...为ex..filename.jpg
<?php
if (isset($_GET['id'])){
$id = $_GET['id'];
}
$username="--";
$password="--";
$hostname = "xxxx";
//connection string with database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
// connect with database
$selected = mysql_select_db("1775125_tourist",$dbhandle)
or die("Could not select examples");
$query = mysql_query("Select * FROM photo_details WHERE place_id = '$id'");
while($row = mysql_fetch_assoc($query)){
$imageData = $row["photo"];
}
$url = "http://optimusone.net46.net/testing_only/uploads/".$imageData;
header('Content-Type: image/jpg');
imagejpeg($url);
?>