在 php 的图像字段中查看图像


View image in the image field of the php

美好的一天!

谁能帮我,有一个系统,用户确实通过他们的桌面在网络上托管的数据库中注册,我们现在正在开发这个系统的 Web 界面,然后它在系统中具有一定的功能,我必须显示照片用户。

我在SQL Server中做了正常的SELECT,但是在imagejpeg($ img)上;它不显示整个图片,只是图片的一部分。谁能帮我?我正在网络上寻找一些教程,他们说这是因为字段的大小。如果字段的类型为(图像)且返回为十六进制。

下面我试图在朋友的帮助下做一个功能,但她也没有工作:

<php
 $id     = (int)$_GET['id'];
 $qryimg = mssql_query(gimage SELECT FROM user WHERE id = {$ id});
 $resimg = mssql_fetch_array($qryimg);
 $im1    = $resimg['gimage'];
 header("Content-type: image/jpg");
 $image='';
 for($i=2; $i<strlen($im1); $i+=2)
 {
     $hex = $im1{$i} . $im1{($i + 1)};
     $cod = hexdec( $hex );
     $image .= chr( $cod );
 }
 echo $image;
 #echo imagejpeg($image);
?>

为什么下面的代码不起作用?你不能只是呼应图像吗?

<php
 $id     = (int)$_GET['id'];
 $qryimg = mssql_query(gimage SELECT FROM user WHERE id = {$ id});
 $resimg = mssql_fetch_array($qryimg);
 $im1    = $resimg['gimage'];
 header("Content-type: image/jpg");
 print $im1;
 exit;

gimage 是什么字段类型?