Display a database image from MSSQL database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi... I need to display some images that exists inside one MSSQL
server in a BLOB datatype field, but my code don't work...

My code:

<?
$arg = $_GET["codPessoa"];
mssql_connect("server", "web", "web");
$sql = "SELECT Foto FROM Foto WHERE CodPessoa=$arg";
$result = mssql_query($sql);
$data = mssql_result($result, 0, "Foto");
$data = stripslashes($data);
header("Content-type: image/gif");
echo $data;
exit;
?> 

And I access this page sending in the URL the text:
.../showimage.php?codPessoa=xxx.

I receive a strange code like
Fh54757eFg554257eFrgtth547d54e7t8h54j87j85fd54ss7f...... Accessing
this page by IE nothing happens but when a I try to access in Mozilla
Firefox I got an error saying that the image cointain errors and
cannot be displayed... If i try to show inside an img TAG in other
page like <img src="patch/to/page" /> the code display a X error img,
like if the image don't exist, but the code keep returning the strange
code, so I believe that this is the image in a "string format" and
something makes with the conversion for a real image format don't work
very well.

Sorry my bad english...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux