CodeIgniter Forums
How do I display an image in mysql - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How do I display an image in mysql (/showthread.php?tid=26570)

Pages: 1 2


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]farocco[/eluser]
Hello,

I have images stored in mysql that I want to display in a list.
The format is a blob.

I cannot get this to work.


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]JHackamack[/eluser]
Do you have sample code that you can post?


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]farocco[/eluser]
<img height="100" width="100">image?&gt;"

Thanks


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]JHackamack[/eluser]
I believe you might need something like:
Code:
src='data:image/png;base64,&lt;?php echo $image; ?&gt;' alt="Red dot"

If your image is a png and base64 encoded.


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]farocco[/eluser]
<img height="100" width="100" alt="red dot">image?&gt;">

Still not working


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]JHackamack[/eluser]
What is the HTML being output in your view?

And I see you don't have a SRC tag, which is required


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]farocco[/eluser]
My code is getting mangled. I do have a src tag.

How can I paste the code to show?

E•–x¦N ààçÐüØÁÆ)ûIwDvMc6HòÇ÷JŸÓ9ý*¼°˜ÛlˆQ½`þ´ºmùº°²¼>t1˹ŽC'ó8®/ÂWóéÞ/ñ$:…»?Ú";•„C'ûÌ8Ã(À9ã5J«êK‚èuÅG ü©¥ì?*°ÿ?Ý·º„Ÿáp~a‰­BÙ A08*F h¤žÄ¸µ¹"úʘQyà~U+uÅ1ª™$EÐ~TÆEÏAùT­M


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]JHackamack[/eluser]
before you insert into the database do a base64_encode, then echo out the blob normally
Thus you can use the example I have in #3 with the base_64 and it should work.


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]farocco[/eluser]
Thank you

Any way around this with existing images?


How do I display an image in mysql - El Forum - 01-17-2010

[eluser]JHackamack[/eluser]
use base64_encode around your $image blob.