I have an image in binary blob field and I am unable to read.
In the database looks like this:
Yes, this is the shape of the image into text.
This and how image:
I tried several things and the only one that approximates the expected result was:
echo '<img src="data:image/jpeg;base64,'.base64_encode( $result->fields['LOGO'] ).'"/>';
Resulting in:
Content blob taken from a select:
BM606(##0``ÿÿÿÿÿÿøøøøøøÿÿÿÿÿÿÿÿÿèèèOOOBBBTTTTTTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSQQQPPPPPPPPPPPPRRRTTTSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSTTTBBBOOOèèèÿÿÿÿÿÿgggEEE===,,,###======###+++>>>EEEgggÿÿÿÉÉÉ666+++ 444111111444 ***666ÉÉÉ$$$ ;;;777777;;; $$$ !!!???;;;;;;???""" #GVLqz ¨´gih $$$BBB>>>>>>BBB$$$!+$/J8#cNX{eu® ¿ÌÄ ³³³&&& '''FFFBBBBBBFFF&&&(D2.Z>6dGGqVap¡¬ÁµÐÝÖMOO*N8&K5#9+' %%%´´´ÄÄÄ---)))JJJFFFFFFJJJ((( %"*N7(Z;/`A?mQLqaOcZT[S`c`lmh'L4(a?(_=-`A0F8---ÄÄÄÑÑÑ555+++NNNJJJJJJNNN***)P7%[9+^=;iO5E=:)H$P$M K"O, 9&!A0)b#)dA.eC(5-666ÑÑÑÝÝÝ###...RRRMMMMMMRRR---'C2&\:'^<8bL/0)H#^/`3^/X&^/`3_2U, 1E0*iF,fC*gA2aD###ÝÝÝèèèKKK000VVVQQQQQQVVV000!*$([<'a=5eJ.1,O'c4`-[&rK%¢rK%[&_,g1J#/M#)N8,kD.jF,B4LLLèèèñññUUU222ZZZUUUUUUZZZ222'F2(d?/gD,#8C!f6m< |d{T5ÈÒÚ{T5|dm< e5K(&$-fC-oG3_CUUUñññúúú]]]555^^^YYYYYY^^^333!+Z<+iB4cJ-$c4n7eAÈÎÕÄÈÊÊÑ×ÃÇÊÊÑ×ÄÈÊÈÎÕe#m5g81$'R;.sI4oJ)1,]]]úúúÿÿÿiii777bbb]]]]]]bbb777,<2,fB/nF-M?=#o>t:u>ÂÀ¾ÍÑפw\6¤wÍÑ×ÂÀ¾u>t:o>E* :01tK4vN?YG iiiÿÿÿÿÿÿxxx"""999gggaaaaaaggg9998YC.mF2qJ)=6H' v>^.µ¤ÖÜã±s4x<s4±ÖÜ㵤_-u=R0#5/1uL4{P#jO"""xxxÿÿÿÿÿÿ%%%===lllffffffmmm>>>&O40rI5uN'84I${<«kèöÿÜàè¦Y}=P}=¦ZÜàèèöÿ¬ky;T/%613zO7S9fJ%%%ÿÿÿÿÿÿ(((###sssllllllsss???2Z#2vK5xO)<6J) IZ¯cãéîÌÀ²H#HÌÀ²ãéî¯cZHR1#:25R:WHlV***ÿÿÿÿÿÿ,,, !!! !!! !!! !!! !!!!!!CCCxxxqqqqqqxxxCCC6N>3wL5|P/K?8"JS\ßÝÛìôþÕɺº~ÕɺìôýßÝÛ\SJA+%J98W=Z;KA---ÿÿÿÿÿÿ©©©000 ###### """"""!!!!!!""""""""" ###"""!!! """$$$""" """!!!!!!FFF{{{tttttt{{{FFF '.*3rJ5R7fJ) i;WµLñøÿäáÛðõûð÷þðõûäáÛñøÿµLUo?2,,2pL;\?}X)))111©©©ÿÿÿÿÿÿµµµ444 !!!"""#########$$$"""###!!!!!!###""""""""""""###"""!!!$$$"""###$$$"""###GGGyyyyyyGGG###$##3bD7T9~S+63;"I¯fºE¦bÌ«ÿÿÿÌ«¦bºEdIG-)C8;Y=_?fM""" 444¶¶¶ÿÿÿÿÿÿÀÀÀ888!!!###$$$$$$%%%%%%%%%######"""$$$%%%$$$$$$###$$$$$$$$$$$$%%%$$$%%%%%%$$$###KKK~~~~~~JJJ$$$$$$/D77S9W9hK,TDII(I±f²e¹zÒªn¹z²e°dMT3/648T>bDa183### 888¿¿¿ÿÿÿÿÿÿËËË;;;"""&&&%%%%%%%%%%%%%%%&&&((($$$%%%%%%%%%%%%%%%$$$%%%&&&%%%%%%%%%%%%$$$%%%(((LLLLLL&&&%%%(((6oK:Y9U9X<[HB$r?Y¨b¦[§aYuB I-187:{V#dAdAdN$$$&&&$$$<<<ÊÊÊÿÿÿÿÿÿÔÔÔ###%%%&&&&&&&&&((('''((('''((((((%%%&&&&&&&&&&&&''')))''''''%%%'''''''''''''''PPPPPP'''&&&&&&0=58T;[<Y9bI'''3*%C*N)S+ U/H-9316SF#]C hBgI~\,*+''''''%%%AAAÕÕÕÿÿÿÿÿÿÞÞÞDDD$$$'''((('''(((((())))))(((((()))(((((((((((()))'''&&&((('''((()))))))))'''###jjjeeeeeekkk???$$$'''(((3N<:U<Z;[AwT''' ¶¯j|uYkbMf[Fr_IfIkG¦lE¡iH]222((())))))%%%EEEÞÞÞÿÿÿÿÿÿçççJJJ&&&(((***+++***))))))+++((()))***+++***)))++++++)))(((***+++***)))***!!!OOO¹¹¹³³³²²²µµµµµµ²²²³³³¹¹¹LLL ***-1.0834J<9fI8fIGJHÎäÖºÞÈϱÀkµ\°}R®vL¨pJjCjR/,.******)))***'''JJJæææÿÿÿÿÿÿîîîUUU)))+++***+++***++++++++++++---+++)))+++++++++,,,***++++++***+++***+++!!!XXXÞÞÞØØØÍÍÍÃÃÃÃÃÃÍÍÍ×××ÝÝÝXXX ***+++)))+++,,,***rxt±Æ¹¦Í´Ç¥w¼g³Y¨wNgCoT7?:***+++******++++++)))WWWíííÿÿÿÿÿÿóóó___+++---,,,+++---,,,...,,,***---,,,+++,,,...---,,,+++---...+++,,,,,,---!!!WWWÚÚÚÔÔÔÄÄÄÃÃÃÃÃÃÄÄÄÓÓÓÙÙÙXXX$$$,,,,,,,,,,,,---++++++9:9U\Wh~po{[yeCRH000,,,------+++,,,,,,...++++++aaaóóóÿÿÿÿÿÿùùùjjj---------...000---...///............///......///------------111---...$$$^^^ãããØØØÙÙÙïïïîîîÙÙÙ×××âââ\\\###,,,//////---//////............000///......---------...000---...---000kkkøøøÿÿÿÿÿÿýýýsss222///...///000/////////111///000///000000//////111000///...000//////###MMMÌÌÌ¿¿¿ÅÅÅÖÖÖÖÖÖÅÅÅÀÀÀËËËLLL$$$...000000/////////000///000000000000...///111000...///000//////...333tttýýýÿÿÿÿÿÿÿÿÿ666000222222///111111111111222111111333111111111111222222222000111111111hhheee000111111///222222111111222111222222000111111111222222222000111111///666ÿÿÿÿÿÿÿÿÿÿÿÿ222000111111111111222000000111111222222222333333111222111111111111...:::ÆÆÆÑÑÑÌÌÌÊÊÊÉÉÉÇÇÇÇÇÇÆÆÆÊÊʾ¾¾999...111111222111111000222222222333111333222222222111111111111222...222ÿÿÿÿÿÿÿÿÿÛÛÛWWWIIIJJJIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHIIIIIIIIIIIIJJJIIIIIIIIIIIIEEEQQQÛÛÛäääÞÞÞÝÝÝÜÜÜÛÛÛÚÚÚÙÙÙÝÝÝÒÒÒQQQFFFIIIIIIIIIIIIIIIIIIIIIIIIHHHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIHHHHHHWWWÛÛÛÿÿÿõõõkkk888ÁÁÁ÷÷÷ïïïîîîíííííííííìììòòò»»»888kkkõõõ¢¢¢999PPPöööîîîììììììììììììîîîöööPPP999¢¢¢^^^+++UUUùùùñññïïïîîîîîîîîîðððøøøUUU+++]]]PPP&&& ZZZÿÿÿøøøõõõõõõôôôóóó÷÷÷ÿÿÿZZZ !!! &&&QQQaaa&&& !!!""""""""""""!!!###!!!"""""""""!!!!!!"""###!!! """"""""""""!!!"""ZZZøøøöööõõõôôôôôôõõõõõõ÷÷÷ZZZ!!!!!!""""""###!!!""""""!!! !!!"""###!!!!!!""""""!!!"""!!!"""!!!"""!!!&&&bbbwww((("""###$$$$$$######$$$############$$$""""""$$$############$$$######$$$###!!!---AAAiiihhhAAA---!!!$$$"""$$$$$$###$$$"""############$$$######"""$$$#########$$$######$$$!!!(((www+++$$$$$$%%%&&&%%%%%%&&&%%%%%%$$$$$$%%%%%%%%%$$$%%%%%%%%%$$$&&&%%%%%%&&&%%%&&&"""DDD||||||FFF!!!'''%%%%%%&&&%%%%%%&&&$$$$$$%%%$$$%%%$$$%%%&&&$$$%%%%%%%%%&&&&&&%%%%%%$$$"""+++///%%%''''''((('''(((''''''&&&&&&'''((('''''''''''''''((('''''''''''''''''''''&&&PPPPPP'''((('''''''''&&&'''&&&&&&'''((('''''''''''''''''''''(((''''''''''''&&&&&&&&&...¯¯¯333''')))))))))***))))))***+++)))))))))((())))))((())))))))))))***)))*********))) TTTTTT!!!))))))))))))))))))******))))))((())))))))))))***)))))))))***)))))))))***)))'''333°°°½½½;;;***++++++***,,,,,,,,,+++,,,,,,,,,,,,++++++,,,,,,,,,+++***+++,,,---,,,+++,,,,,,###YYY ZZZ###+++***+++,,,,,,+++,,,,,,,,,,,,+++***++++++---,,,+++******,,,,,,,,,+++,,,,,,***999½½½ÉÉÉAAA+++,,,............//////---............///.........,,,---...///......///...---%%%aaa¬¬¬££££££aaa###---............//////......///...///...//////---,,,---............///......---###ÉÉÉÕÕÕGGG///000111111111111000111000111111111111000111111111///111111111000000000111111'''iii»»»±±±±±±»»»hhh%%%000111111000000000111000111000222111///111111111000111111111000000111000000///GGGÕÕÕàààTTT555888777777777777888888666888777666666777888777666888777777888777777888666888---qqqÉÉɾ¾¾¾¾¾ÉÉÉqqq,,,888777777666777888777777888777666777888888777777999777777777666888888666888666UUUáááëëëiiiBBBFFFGGGEEEFFFEEEFFFFFFDDDFFFFFFEEEFFFGGGFFFEEEDDDEEEGGGDDDFFFEEEFFFFFFDDDEEE;;;~~~ÖÖÖËËËËËËÖÖÖ~~~999GGGEEEEEEFFFFFFFFFEEEEEEFFFEEEDDDFFFFFFFFFEEEDDDFFFFFFEEEFFFEEEFFFFFFDDDFFFCCCiiiìììôôôVVVXXXVVVVVVZZZVVVXXXYYYXXXWWWWWWWWWXXXXXXXXXWWWXXXWWWWWWUUUYYYWWWWWWYYYYYYWWWLLLâââ××××××âââMMMWWWUUUXXXYYYVVVXXXXXXWWWWWWWWWWWWXXXXXXXXXWWWWWWXXXVVVWWWYYYVVVXXXXXXYYYWWWVVVôôôûûûiiijjjiiijjjiiiiiijjjiiikkkjjjjjjjjjjjjhhhhhhhhhkkkkkkjjjjjjiiiiiiiiiiiijjjkkk___êêêààààààêêêbbbkkkjjjjjjiiijjjiiiiiikkkiiijjjkkkiiiiiigggiiikkkjjjiiijjjiiiiiiiiihhhjjjjjjhhhûûûÿÿÿ¥¥¥xxxzzz{{{zzzxxxyyy|||xxxxxx{{{zzzyyy|||zzz{{{zzzyyy{{{{{{zzzyyywww{{{yyywwwyyyppp¥¥¥ïïïææææææïï襤¤ppp{{{{{{zzzwwwzzzzzzxxxyyyzzzyyyzzz|||zzz|||yyyyyyzzzzzzzzzxxxyyy{{{xxxwwwzzzxxx¦¦¦ÿÿÿÿÿÿ²²²}}}¬¬¬ñññééééééñññ¬¬¬²²²ÿÿÿÿÿÿ¹¹¹íííååååååììì°°°¹¹¹ÿÿÿÿÿÿººº¥¥¥áááÚÚÚÚÚÚáá᧧§~~~ºººÿÿÿÿÿÿÅÅÅpppmmmooonnnmmmmmmnnnmmmnnnoooooolllnnnmmmlllooonnnnnnnnnooolllnnnmmmmmmmmmooohhhÏÏÏÈÈÈÈÈÈÏÏÏeeemmmnnnmmmnnnmmmmmmllloooooonnnllloookkkmmmooommmmmmnnnnnnmmmnnnnnnlllnnnnnnrrrÅÅÅÿÿÿÿÿÿííí]]]MMMOOOOOOQQQOOOMMMQQQMMMMMMOOOOOOOOONNNNNNOOOOOONNNOOOOOOPPPPPPMMMPPPOOOMMMGGG{{{ººº²²²²²²ºººzzzFFFNNNOOOPPPQQQMMMNNNPPPLLLNNNOOONNNNNNNNNNNNPPPOOONNNOOOOOOPPPOOOMMMQQQMMMLLL]]]îîîÿÿÿÿÿÿÿÿÿ¼¼¼666---............---...///......///...,,,,,,,,,------++++++//////------///%%%___££££££^^^%%%...---///...///******------------...---------...///---......///...---...666¼¼¼ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿËËËlllNNNMMMNNNMMMMMMNNNNNNMMMRRRCCC!!!!!!!!! !!! !!!$$$IIIQQQNNNNNNOOOFFFwww±±±ªªªªªª±±±wwwGGGOOONNNNNNQQQJJJ### !!! !!! !!!CCCRRRMMMNNNNNNNNNNNNOOONNNMMMlllËËËÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿëëëzzz||||||}}}qqq|||õõõÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿõõõ|||qqq~~~||||||zzzëëëÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿéééåååÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿåååéééÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÙÙÙRRRHHH\\\hhhsss{{{{{{sssiii]]]HHHSSSÚÚÚÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ§§§¤¤¤EEE111222000///...------,,,,,,------...///000111000EEE¤¤¤¨¨¨ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ¢¢¢mmm```dddfffgggiiijjjjjjkkkjjjjjjjjjiiigggeeeccc```mmm¢¢¢ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿùùù¼¼¼lllYYYYYYUUUTTTRRRRRRRRRQQQQQQPPPQQQRRRSSSUUUXXXYYYjjj¼¼¼ùùùÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿðððãããÛÛÛÔÔÔÎÎÎÉÉÉÇÇÇÃÃÃÁÁÁÁÁÁÂÂÂÃÃÃÈÈÈÍÍÍÔÔÔÛÛÛãããïïïÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
How can I perform the reading of the image correctly in php?
OK, you are definitely using wrong MIME type. Since you said in the comment that original image is BMP, try:
echo '<img src="data:image/x-windows-bmp;base64,'.base64_encode( $result->fields['LOGO'] ).'"/>';
or:
echo '<img src="data:image/bmp;base64,'.base64_encode( $result->fields['LOGO'] ).'"/>';
If it still doesn't work, try skipping first 8 bytes, simple substr might work here. You need to skip 8 bytes, since bitmap adds 4 bytes as header for specific image type (in your case: BM) and 4 more for file size. You can find more info on Bitmap file header here.
Is there a way to turn a jpg to string, reverse of imagecreatefromstring?
I have to communicate to a server which needs binary of image, i saw plenty of jpg to binary but not the other way around.
Just a shot in the dark here... No real experience with this, just my thoughts after looking through some documentation...
I see in the documentation of imagecreatefromstring() an example is given where a base64 encoded string is converted into an image. Taking that example and flipping it around might just be what you are looking for.
$image = file_get_contents('image_file.jpg');
$imageString = base64_encode($image);
imagecreatefromstring takes a string which contains the binary data of an image and turns it into a gd image resource so you can manipulate it with the gd image library. Literally the "reverse" of that would be imagejpeg, which saves a gd image resource to a jpeg image.
I guess what you really want though is simply the initial string, which contains the binary data of the image to begin with. I.e.:
$imageString = file_get_contents('image.jpg');
$gd = imagecreatefromstring($imageString);
Just skip step 2.
I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have?
I am only familiar with PHP
As far as I remember there is an xml element for the image data. You can use this website to encode a file (use the upload field). Then just copy and paste the data to the XML element.
You could also use PHP to do this like so:
<?php
$im = file_get_contents('filename.gif');
$imdata = base64_encode($im);
?>
Use Mozilla's guide for help on creating OpenSearch plugins. For example, the icon element is used like this:
<img width="16" height="16">data:image/x-icon;base64,imageData</>
Where imageData is your base64 data.
$encoded_data = base64_encode(file_get_contents('path-to-your-image.jpg'));
My synopsis of rfc2397 is:
Once you've got your base64 encoded image data put it inside the <Image></Image> tags prefixed with "data:{mimetype};base64," this is similar to the prefixing done in the parenthesis of url() definition in CSS or in the quoted value of the src attribute of the img tag in [X]HTML. You can test the data url in firefox by putting the data:image/... line into the URL field and pressing enter, it should show your image.
For actually encoding I think we need to go over all your options, not just PHP,
because there's so many ways to base64 encode something.
Use the base64 command line tool. It's part of the GNU coreutils (v6+) and pretty much default in any Cygwin, Linux, GnuWin32 install, but not the BSDs I tried. Issue: $ base64 imagefile.ico > imagefile.base64.txt
Use a tool that features the option to convert to base64, like Notepad++ which has the feature under plugins->MIME tools->base64 Encode
Email yourself the file and view the raw email contents, copy and paste.
Use a web form.
A note on mime-types:
I would prefer you use one of image/png image/jpeg or image/gif as I can't find the popular image/x-icon. Should that be image/vnd.microsoft.icon?
Also the other formats are much shorter.
compare 265 bytes vs 1150 bytes:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAVFBMVEWcZjTcViTMuqT8/vzcYjTkhhTkljT87tz03sRkZmS8mnT03tT89vTsvoTk1sz86uTkekzkjmzkwpT01rTsmnzsplTUwqz89uy0jmzsrmTknkT0zqT3X4fRAAAAbklEQVR4XnXOVw6FIBBAUafQsZfX9r/PB8JoTPT+QE4o01AtMoS8HkALcH8BGmGIAvaXLw0wCqxKz0Q9w1LBfFSiJBzljVerlbYhlBO4dZHM/F3llybncbIC6N+70Q7OlUm7DdO+gKs9gyRwdgd/LOcGXHzLN5gAAAAASUVORK5CYII=
data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAD/////ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv///////////2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb///////////9mZmb/ZmZm//////////////////////////////////////////////////////9mZmb/ZmZm////////////ZmZm/2ZmZv//////ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv//////ZmZm/2ZmZv///////////2ZmZv9mZmb//////2ZmZv9mZmb/ZmZm/2ZmZv9mZmb/ZmZm/2ZmZv9mZmb//////2ZmZv9mZmb///////////9mZmb/ZmZm////////////////////////////8fX4/8nW5P+twtb/oLjP//////9mZmb/ZmZm////////////////////////////oLjP/3eZu/9pj7T/M2aZ/zNmmf8zZpn/M2aZ/zNmmf///////////////////////////////////////////zNmmf8zZpn/M2aZ/zNmmf8zZpn/d5m7/6C4z/+WwuH/wN/3//////////////////////////////////////+guM//rcLW/8nW5P/x9fj//////9/v+/+w1/X/QZ7m/1Cm6P//////////////////////////////////////////////////////7/f9/4C+7v8xluT/EYbg/zGW5P/A3/f/0933/9Pd9//////////////////////////////////f7/v/YK7q/xGG4P8RhuD/MZbk/7DX9f//////4uj6/zJh2/8yYdv/8PT8////////////////////////////UKbo/xGG4P8xluT/sNf1////////////4uj6/zJh2/8jVtj/e5ro/////////////////////////////////8Df9/+gz/P/////////////////8PT8/0944P8jVtj/bI7l/////////////////////////////////////////////////////////////////2yO5f8jVtj/T3jg//D0/P///////////////////////////////////////////////////////////3ua6P8jVtj/MmHb/+Lo+v////////////////////////////////////////////////////////////D0/P8yYdv/I1bY/9Pd9///////////////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
Check the following example:
// First get your image
$imgPath = 'path-to-your-picture/image.jpg';
$img = base64_encode(file_get_contents($imgPath));
echo '<img width="100" height="100" src="data:image/jpg;base64,'. $img .'" />'
Google led me to this solution (base64_encode). Hope this helps!