Jump to content

Image Mysql Problem


seran128

Recommended Posts

My Code that displays the image that returns this

GIF89a÷ÿtÓAaÇ1b·PY¾,X¾+C§"ØëÞæíðÖëܵè°ãíìÙìàãíí°Úµ®ç¦ÌèÔÅéÄÜìãÔëØ»öˆ¶è±{¾räíî×LÜìä]Ã.×ëÝ~¾t¯ç¨}¾t£ën[À,kÀRáìê^¹NhÈ@U¸-”â_¨ãƒbÂ=Ôÿ¤®ð|M²'ƒÂ|jÆ>œçgU»){ÇimÏ:ßZŽàXÛKn¼^ñþáR¸(¾÷‹Æü“¨íuÊêÌ[À.‡ØWH®%­ï{R¸+–àkÚìáÚèé¾ø‹xÅg†ÚWáý¯»òÓÿ¥Äú‘ÀꦩìwnÏnÁOmÅOmÏ9N°*c½JEª$„ÛOÝþ«Ÿåv]Â/R°CãÿÄ}ÖSpÎEÂꩶݺ¼÷‰Þÿ½ÆfÛÿ¶­ï|¨ívuÍHÝìåÉý–ŠßVšåg[·LR·)Ðÿ’͉W¼-†ÙWÓþ©iÍ5¸ô„­ïzZÀ/žçl«íyïÿº¢á|©ç ªç~öÿÂýÿÉèÿÐÂÞÐìÿÖqÒ>àÿª€¾väÿ®]Ä-Óþ wÓMìÿÓÔÿ¡ÖcžèjÇû”g¿Pc¸Se¹Q€×MÎèÖ}ÆbîþÝÛìâ`¾7vÔBÚéç…ÚU]¼4†ÂÞìçåÿ²ÐèÛÔOuÐD‹Ú`ŽÜb±ì‡bÈ2fË3fË4˜ßlÕþ«ÊäÔÍçÖkÁOÇêÈÕëÚ—äblÌ:nÏ;nÑ;»ìšC¨!²ç¬G¬#Ýý»à]¼êžºô†J¯&žát=£ ‹ÞYaºFåýÌæýÏâÿÇñþä~ÓPzÕGqÊCQ¸*ÃꬦìqjÎ7¶Ü½eÂ:[¹GÝý¼Çý‘|ÅgM´'`µPÜÿ´¶ô‚wÅ[®îzÑçÝ©ív~ÍcwÏI^Ã/Èý–Éý—‰ÝW˜åfÔëÙÍèÔ‚ÆiQ¶)Q¶*yÐJÐþžbÆ1W¼,|ÖI¯Ú´W½,Žß[ÖLÓþ¨L±&hÌ5Íý›I¯$¸õ„®ï|¿é½©íuZÁ,žælçíò!ùÿ,ÿÿ (¤X.%ÎÌü’ôi Ç»€´)Y D&JAÜøï@¦JcŒ:†,Ѓ "+[¯4ÔÖ;™ÒáXYPÐ{•‰+š5€Å¥š88ãp¤:‡r£;D^H±FÃI>`&ì™2MÄœ9PÄj:êÛŒ8%Zxà·„>¼=›TK†Ñ r© ‰N,ܬ3…§'ÊÀ1“jK .ÀV€W½f.ôËÐ(Çñl\ ¦kdÉð©»Ó'@+hLpÝÒ¢gU˜?TtùßKéÜ…cÀ² ó.¼ó”È^»?zœö-€Î€v¶Na"×

Instead of an Image.

[code]<?
header("Content-type: image/gif"); 
include("include/sitefunctions.php");
include("include/connection.php");

$itemid = $_POST['ItemId'];
echo $itemid;

$info=getpicturecontent($itemid);


?>

<html>
<head>
<title>Image Display</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.box {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    border: 1px solid #000000;
}
-->
</style>
</head>

<body>


<?
echo $info;
?>[/code]

My Function

[code]function getpicturecontent($inId){
global $connection;
$sql="select * from images where ItemId='$inId'";
echo $sql;
$result=mysql_query($sql,$connection) or die(mysql_error());
while($row=mysql_fetch_array($result)) {
$getpicturecontent .= "<table width='200' border='0'>
    <tr>
      <td>" . $row['content'] . "</td>
    </tr>
    <tr>
      <td></td>
    </tr>
  </table>";
}
return $getpicturecontent;
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/28398-image-mysql-problem/
Share on other sites

i am assuming the data type for the picture in the sql db is a blob. well you must use headers. add this at the top, below <?php

[code=php:0]
header("Content-type: image/type");
[/code]
remember to change type to the image type, jpeg or png.
Link to comment
https://forums.phpfreaks.com/topic/28398-image-mysql-problem/#findComment-130009
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.