use IMG to display image but shows garbage


dear all,

how output dynamic images along html php scripts.

it ends looking bunch of garbage.

i pass picture number following php pgm , asume display picture. however, shows lot of garbage. parameters pass php pgm should ok.
please help.
many thanks.




<?php require_once('connections/abc.php'); ?>
<?php

$colname_recordset1 = "-1";
if (isset($_get['id'])) {
$colname_recordset1 = (get_magic_quotes_gpc()) ? $_get['id'] : addslashes($_get['id']);
}
mysql_select_db($database_abc, $abc);
$query_recordset1 = sprintf("select * replyarticle postid = %s", $colname_recordset1);
$recordset1 = mysql_query($query_recordset1, $abb) or die(mysql_error());
$row_recordset1 = mysql_fetch_assoc($recordset1);
$totalrows_recordset1 = mysql_num_rows($recordset1);

?>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" " http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=" />
<title>untitled document</title>
</head>

<body>
<?php
$img= $row_recordset1['book_no']; ?>

<?php
$img_name=$img;

header("content-type: image/jpeg");
list($w,$h)=getimagesize($img_name);

$src_img=imagecreatefromjpeg($img_name);
imagejpeg($src_img);
imagedestroy($src_img);

mysql_free_result($recordset1);
?>

</body>
</html>

hi,

the code using looks correct!

first confirm type of field in mysql stores images longblob , try save fetched image @ on server , use img src tag show it.

even if not show image encrypted data mean there problem while saving images in mysql table.

hope helps!

cheers,

~maneet
lexolution services
web development company


More discussions in Dreamweaver support forum


adobe

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62