,这里是我的图像显示的代码 -不能在PHP中显示图像
$username = "xxxxxxxx";
$password = "xxxxxxxx";
$host = "000.001.000.000";
$database = "xxxxxxxx";
@mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
@mysql_select_db($database) or die("Can not select the database: ".mysql_error());
$query = mysql_query("SELECT mimetype, Image FROM table ORDER BY id DESC LIMIT 0,1");
$row = mysql_fetch_array($query);
$content = $row['Image'];
header('Content-type: image/jpg');
echo $content;
这是我得到
的图像错误“HTTP:// WWW ....”无法显示因为它包含错误。
有什么不对?在mysql中字段的数据类型是MEDIUMBLOB
图像文件有多大?它在被添加到数据库之前是否被编码(例如,mysql_escape_chars?)? – Rasika
什么样的错误? –
你确定你所显示的图片是JPEG吗?你正在获取mimetype和image,但是没有使用mimetype - 它告诉我你可能会存储多个文件类型(gif/jpg/png等等) – dan