You know when you open up an image in notepad or a text editor, you get a lot of random illegible text that looks like a bunch of foreign letters.
For instance, this image:
results in:
‰PNG
IHDR szzô gAMA ¯È7Šé tEXtSoftware Adobe ImageReadyqÉe< ÉIDATxÚbüÿÿ?Ã@€ bŒŒŒD)>ÎÀ t®Ûÿc` ±4¾ ¤? ñAÛa1æ<@Œ`NA,* âx
ð©æ€XÇ_€ø7Cô H/Ò|€Ãç € Âë å@j>È· b~yy[[& b؇Ÿfx}éà ÿ;Ä1€ŽHôÇ" »§N30ôƒ|’b‰°0ÖÈHf¼ÁúïÑ#†?Ë—3Ü›5‹áÞ§O¿ ™ÌÀPˆÍ „Õ@Ëç-O`²å54xkj˜-,HJ\ÿ?~døPVÆpfï^†OG,†º ÃÀ`ïR|@BÚÎŽ»±‘‘——ìTþméR†ýýO !‰ »ÅÐ8_ò¹²•OSÂ$> “>}"ÎV4µßwì`ØßÓÃðâˆÀhš Ù
@p@Sû}& ,*Ê ÐÝÍÀÈÍ
1AQ‘Áؘ¿§Ná·ÜÌŒANŽáìY i÷áÂï¦LaØsð (M€²«b<(í &xp@²š (ÁñÅÅ10þ*}ÿžALb9€60€ˆcà 9 éé…Ê 2¨sr2@˘½ „ì€xPVSRb`º˜}Ù€‘L(@E…=`ydÉ!^@y‡´||8!ÑS@,°TÈÙl††Wƒ ˆ%,`@[›B«WCø¡¡1t ÔûX.ü}ü˜áÏ[_¾d …Ï ]³!ém@ ±@}*^x€®eF»wCf•þü ñ!2 9$c£¿k×2ü®eø}ý:Š¸_†„‚È v cŠn„ï‘ÁĉËQÅq”
¿,`ø‘˜ˆUN ì@ÓìA|€ ‚…€ ¨lgááÁî ho‡»»;ÞL€Ïràâ·0 ,ÀµÃ¨Áª«!!áçG¶åP†€`! Æß¿ãøó‡â6 Ô` @°¸ Jˆ`àk LŸÎÀ„Sš5!Lÿ"
P_ ±æ€_APð‚â˜7!"‚ ï@Ž %èßxñâ p; €˜ .:²ö+Ð÷ÿ°àÿ Ëãã1«^`œƒ0:`:‚mþ|f
ƒ"øÄÓAj\!ì
;€î¸ÄÿÐñüùÿ± 8LÍjþ!©ác@ÜĽ æÐn€ b€5J·«Ž} ÃØÙØԻ勣ªa6 2IÝ =@»`ž x] jÃÒÁ=& ¨á»wrsQÃwÅ
†ü|„‰äH/Ȩšs@³?@¢|!L @ Á«ãÍÀ‚èˆû,LLÀʈ‹…a¨¬ïÚš5EEøSa0€CBŠ‹u|fßEÀºàû¿ 7(–A«c€ Bil€TJëùØÙì€NV&&„Áššhå:N€¦öç¿+>dx ©;Ë$ „Ñ$[mŒÊ 1 ëvVä üú|?°!sX‚šéåhM2€ ÂÚ(] m”òãÍXÍrsr’eù'`Á¶áêU†—_¿‚,_PŽ¥Q
@8›åË !Á]UUMP³ŒpØ;vû6Ãw` ûÙ „·c²’&@¡!ÀÅÅÅ Lr22‚‚XÕ¿Ö#wŸ<a¸
Œïß¾KX pbžŽ @ ìš-€¶áþ!uÍX
! #þ!Ud¯€–ÿ ãЊÜ52'”èšA ƒY@þáèœþ‡vN‹Ièœã@wÏ Ç}úWF,3 IEND®B`‚
I am very sorry for that :-)
Is there a way to use this wierd sequence of characters to recreate the image in php or in javascript (if you can even do that in javascript) by getting it from a mysql database?
Thanks.
EDIT: My question is: Can I say get that value of the image and put it in a database value, later to retrieve it?
And why, you might say? It is one of those things that is realy bugging me to find out, but I don't know how.
You can use the LONGBLOB
MySQL data type to store it.
With PHP, you just have to send a image header when displaying it:
header("Content-Type: image/png");
// print image contents