Home >Backend Development >PHP Tutorial >从数据库读取二进制图片显示有关问题

从数据库读取二进制图片显示有关问题

WBOY
WBOYOriginal
2016-06-13 10:26:07924browse

从数据库读取二进制图片显示问题
$conn=mssql_connect("192.168.1.70","XXX","123") or die("数据库打开出错");
mssql_select_db("XXX");
mssql_query("set names utf8");

$sql = "SELECT top 1 * FROM sync_info_BlogPic";

$result2=mssql_query($sql);
header("Content-Type: image/jpg");
$row2=mssql_fetch_object($result2);

echo $row2->BlogPic_Content;



error:Image corrupt or truncated



------解决方案--------------------
错误:图像损坏或截断

你是用什么类型字段保存图片的?
------解决方案--------------------
怎么读不重要,怎么存的?
------解决方案--------------------
肯定是入库出问题了, 别想了.
------解决方案--------------------
php 提供给 mssql 的缓冲区可能偏小了
------解决方案--------------------
php.ini

[MSSQL]
; Valid range 0 - 2147483647. Default = 4096.
;mssql.textlimit = 4096

; Valid range 0 - 2147483647. Default = 4096.
;mssql.textsize = 4096

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn