Image error

hi all ,
i’m trying to display image that stored in my database , when i display it in my website i got an error “image cant be displayed because it contain error”
and when i print string of image , its look like this "‰PNG


IHDRَےatEXtSoftwareAdobe ImageReadyqةe<$iTXtXML:com.adobe.xmp
à±M SIDATxعbّےے?1¸wةM‰ئظW<ذإYً€©«ïع°°0zü‎ûكûكƒك؟.…w «A1
­ه,‘’s7’‹’a³7a³##3أد_¾|ےحً‏َO Kکگ9³jŒ؟üٍ›َأ—_قں¾üٍْيأا/؟ق}ْحًêي†×~ل7و×›خْüهOî‡/^½ےءًنص†ûO؟0<~ٌچلeذ@t€پ%GظککK؟ےüثًèٌك‏A$±††‏‏aّû_‌پHہ„E,…÷L.â§ؤصu:Cسو~›8 Kˆ·ôp"±/qˆ4نگھ$ئwگط5@چI ƒ5 Œpے'=ے3L&ٍkPے!ظ€حl¾م<hذ Wژœhط5 يو@¦!AY’n§Mذk·IEND®B`‚"

i created page ‘not in my website’ and its working fine , when i print the string its look like this
"‰PNG


IHDRóÿatEXtSoftwareAdobe ImageReadyqÉe<$iTXtXML:com.adobe.xmp
à±M SIDATxÚbøÿÿ?1¸wÉM‰ÆÙW<ÐÅYð€©«ïÚ°°0züýûßû߃߿.…w «A1
­å,‘’s7’‹’a³7a³##3ÃÏ_¾|ÿÍðþóO K˜9³jŒ¿üò›ó×_ÞŸ¾üúòíÃÇ/¿Þ}úÍðêí†×~á7æ×›ÎúüåOî‡/^½ÿÁðäÕ†ûO¿0<~ñáeÐ@t€%GÙ˜˜K¿ÿüËðèñßþA$±††þþaøû_HÀ„E,…÷L.â§ÄÕu:CÓæ~›8 Kˆ·ôp"±/qˆ4䐪$ÆwØ5@I ƒ5 Œpÿ'=ÿ3L&òkPÿ!Ù€Íl¾ã<hÐ WŽœhØ5 íæ@¦!AY’n§MÐk·IEND®B`‚"

what is the problem and what i should do ?

What PHP and HTML are you using to display the image?

php 5.4 and regular html

this is the source to display it
header(“Content-type: $getInfo”);
echo $fileContent;
exit ;

and this is the source to store it
$fp = fopen($fileData[‘filePath’], ‘rb’);
$binaryString = stream_get_contents($fp);
$arrData = unpack(“H*hex”, $binaryString);
$fp = 0x’ . $arrData[‘hex’] ;

guys , what causing this problem please ?

What’s the value of $getInfo?

image/jpeg or image/png … depend on uploaded file type but for the file above ‘image/png’

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.