You are here: Display a database image from MSSQL database « PHP « IT news, forums, messages
Display a database image from MSSQL database

Posted by Alaor Barroso on 10/20/20 11:16

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...

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация