Jump to content

How to display image stored in mysql field


Guest karthik_srinivasan
 Share

Recommended Posts

Guest karthik_srinivasan

Hi guys,Anyone please help me to solve my problem in displaying image stored in mysql database as Blob type. (Note: The table has only one field image).Database : MysqlTable name : imagesfield name : imageData type : longblobAttribute : Binary<?$sql="select * from images";$res=mysql_query($sql);$arr=mysql_fetch_array($res);echo $arr['image'];?>Output:GIF89a€p!ùÿ,€‡:k÷ÿ÷BZ„ŒŒ¥BcZZï„­­ÖïïZŒæZ„­Œ¥Î!R{c):)Œ1ÞŒ1ZŒ1œŒ1Œ¥1ŒsÞŒsZïÞïZŒsœŒsïœïŒï¥ïœ¥)ÎÞŒµc)ŒZï¥)Îœ)Œ)έޭZ­œ­­¥c:ŒRÞŒRZÎÞÎZŒRœŒRΜΌΥΜ¥ÎÞŒ”cŒZΥΜŒÎZ„Œ­ÅÞ­­Å„”¥­ïæ­¥ïc)ZcZ)Z1:)Z:Z)Œ¥ïŒæ1ŒïæïœæZÎïŒæsZŒkïæZέZŒ))ZÎZ)Îïæï­æcZcZ:Z:ZŒÎæÎœæZÎÎŒæRZŒJÎæZÎŒZŒZÎZÎcJZZ¥­”¥:JZJZÎνÞïsÞïsZ­sÞ­sZ­1Þ­1Zï1Þï1Z­1œ­1­sœ­sï1œï1­¥1­ï¥ï½¥ïsœïs)ïÞ­µc)­Zï¥1)ïœ)­)ïc)”)¥œïµc)ïZ)¥Þ)ïÎsÞÎsZÎsœÎs:)”¥œÎµcïZ¥ÞïïRÞïRZ­RÞ­RZÎ1ÞÎ1Z­Rœ­RÎ1œÎ1­Î¥Î½¥ïRœïRïÞ­”c­ZÎ¥1ïc”)„œï”c)ÎZ)„Þ)ÎÎRÞÎRZÎRœÎRB”„œÎ”cÎZ„ÞÎkBZ¥cZ)BïæÅ)ïæœBÎæÅÎæœÎÖæ:kZïïïæsZïk­æsZ¥ïZ­kcZ¥­æ1ï½æïæ1Zï­Z­)Z¥­Zï))Zï)¥Z)ïÎæsZÎkZ„ïZÎ)¥ZïÎïæRZïJ­æRZ¥ÎZ­JcZ„Îæ1ZïŒZ­Z¥ŒZïZï)„ZïÎæRZÎJZ„ÎZ΄ckZ)Z¥­µ¥:kZkZÎŒïŒkŒ­ŒÎŒJŒŒR{:s:cÿý H° Áƒ€ J€*!20¦ÐŸ€bFÂÏ *Š‰°Ÿ1“(OªLÉr¥Ë–0Wòcà0€M›U|Äìç¯Á›@‹ Ø„A;_*MºS ±§ºž‹ U*Õ©V³VÝŠ•kÔ@oVYàÕX am“çÏ‡Ç P»•nW»xëRôG±/ß¿~,¸0á§>Ó(6Ž§ß ðAr k&Ìy³_u|ûŠMúiéѦS£FíO×YÅš‰.9íXÓºø ȼú´oÕ¿{ïuÊWiÐÅOG m\õr¨Áû6(¦¸oc4“M=ФðïÁÃ?ÿõ.Pê½Àý™j†xþ·.òT™DUqŽ×¸¡7ÍÍgšSã5÷`h'='„}×úõCÞÄ€\V1W\Ày'šp–ÆO_.àÃ.RÍgœ˜_O»„¤V<5°EŽÕØß!⤘×õÅO32fÆW?Z”c•Q‘'U?>µ‹Í¼HS1aVš?ý0`qNé’ß•ïsA¡Òo¡!)YX?4Ð E!€Q1Û±&Ÿ1?‘pÈ ç‘QG!€™T1‘z H„u˜ÕO>°[fQñÖ@Gð„ufMÕOæIÿ5^{ÞÄ*i®ýPŒBbt]fMò³¡|éæck™òà©sE‘¹?uâ§+cýѧjcg3’êÊÑY ·Ñã±€?´Q€€Ö&™PFR”_5s@º 0 ·A˜ÄÀª.ðäµvvDæ¹­Z Hf±À €„1$"V Y·éY»n*£ WÄt€ÌÐ.íÊÏÇüLw@aO¡›l¨õ³©& Ä?‘}xfh[@¢>©áC?ÐÌÄ>¨Ñ'Mníz’ <ÙAó!ºA ”¤øð±<9ù£ªu4û®þü Æ‹ ¶ÿ]Å.Ê ™dU Tjúˆm…ËhOJ\À'T ã<-*ˆ]÷Ø”¼J+€hµ¶\ À‰~è9úât[„¹ªÂ€Ö@Ùj F•½°Ñè`[9±9µgôÉq¢b¯ºô¸Ú’)À°Ž:µ×ÆÖO½n1>èQ«œ©Å’åÝ é¶NJ›µjÜ[ö•]­¬f(g1ÊŸ…@jëTÔð 9±®ƒLøÜv€UeŠR °X¯8"+4¥ @˜43oé­g°ÎÐ@BåGR@ÈÉt&²!.…ðÓ ¯ÔšY%É>pâ‰?ô±b”6·b ÿ«ðc3«*— %¥¶Ì¤ %¬]{"X a€¤5X•™| 0*þ€2 \Uƒ0¤+$Y¼b0Ø-µµ G$Ä—ÔÌ$™“ÊY>4 ìoYdÇ¡«UŒuA(€‰ö¢Ã§ Ð1›þ³ 6ñä’hZˆß#»ÝP zJË}ÚCKN¨”™\ÐIr• DEäÉd#OÉY΋‘¤AzV™IšAY5ÚuÒ20cÐÊ67{J£¦Äù8FEr%‘T¹ ¿ÐqE=«Ÿ¬šYÁ¹'pž2’E†ë IÇL‹+¬.pêf+åÏmþeQÍ:Ó¡£ñ¢Ö´9:Œh¦§˜¿M©¯±Ív".éó¡ÍœDÿšKÎk9i΀ ¤¿©G• :i–œtêA ‚dxæ Mé*Ø„®TËjbSŸ±ÐC‚œ½YÀ Y4„RrÅÿqçyš™%6t—0 iý˜ùg›E–üB›‚Ád5_Ú(àpt«ìù)Gu9¼&6lh­RN¥Šêd"Tœbù²ËFÄ!£¬&qŒŸï`S®£ie@;

Link to comment
Share on other sites

Hitake one more field (image type) in your table.and use this code$sql="select Image,Imagetype from images";$rs=mysql_query($sql) or die("Couldn't get file list sorry"); $imgtype = @mysql_result($rs, 0, "Imagetype"); $imgcontent = @mysql_result($rs, 0, "Image"); header("Content-type: $imgtype"); //have script display as Image type echo $imgcontent;ob_end_flush();may be this will help uregardsLakshmi

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...