Skip to Content.
Sympa Menu

freetds - Re: Display Image Fields From MSSQL.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Leo Kwan" <leo_kwan AT hotmail.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Display Image Fields From MSSQL.
  • Date: Tue, 6 Mar 2001 04:25:20 -0500


Oh the other hand, would you mind please check your httpd error log files.
I've got a error : Attempting to convert unknown source type 34. Do you
know what had happened??

Moreover, is it a good way to get those image from database every time it
needs? I believe that write them to a file and retrive data from database
one time is enough.

> Here is the php code that I use...
>
> Note that this code removes the OLE container of the object. MS-Access store
> the image in an ole container by default which get then stored in the binary
> field... This php code looks for the beginning of the JPEG data by looking
> for the string JFIF. The beginning is then a few characters before...
>
> I hope it helps. It works for me... cf
> http://www.sopac.org.fj/Data/Aerial/Snaps.html?setid=1
>
> ===========================
> <%
> Header("Content-type: image/jpeg");
>
> $conn = sybase_pconnect("SERVER","username","password");
> $ok=sybase_select_db("SOPACDB",$conn);
> if (@$snapid==0)
> {
> $snapid=1;
> }
>
> $result = sybase_query("Snap_Image2vchar ".$snapid);
> $nbrows=sybase_num_rows($result);
>
>
> for ($i = 0 ; $i < $nbrows; $i++)
> {
> sybase_data_seek($result,$i);
> $par = sybase_fetch_object($result);
> if ($i==0)
> {
> // Needs to remove the OLE header if any...
> $pos=strpos($par->Snap,"JFIF");
> echo (substr($par->Snap,$pos-6));
> } else
> {
> echo ($par->Snap);
> }
> }
>
> %>




Archive powered by MHonArc 2.6.24.

Top of Page