September 25th, 2000, 09:21 AM
I'm trying to display an image that is stored in an MS-Access97 Database via ODBC, SQL and
PHP3 on a WinNT4.0 System (SP5).
The Image (a tiff-file) is stored in the Access-DB as an OLE-Object. From an HTML-Page, I
call the following php3-script. In the php3.ini-file, all "magic_quotes_" are disabled.
$dsn = "testDB";
$username = "";
$password = "";
$conn = odbc_connect($dsn, $username, $password);
$sql="SELECT document, id FROM testDB WHERE id = '123456';";
$result_set = odbc_exec($conn, $sql);
while ( odbc_fetch_row($result_set) )
$document = odbc_result($result_set, "document" );
My browser-plugin gets activated, but it cannot display the tif-image. I receive an error
message "Not a TIFF File, bad magic number 7189 (0x1c15)".
I also tried to display a gif-image instead (replacing "image/tiff" by "image/gif" in the
above script), but i receive the broken image icon.
I exprerimented with all combinations of "odbc_longreadlen" and "odbc_binmode" in front of
the while-loop, but no change in the result.
The binary image-data seems to be corrupted on its way from the database (where it is
perfectly readable) to the browser.
Can anybody help please?