rendering images from a database

C

ccc31807

If you have a table in a database with an ID field (int), name
(varchar), a content-type field (varchar) and a data field (blob), and
you have binary data in the data field (like GIFs, JPEGs, PDFs, etc.),
you can display these directly in a new HTML page. A query from the
the database returns this:
id => 666
name => greg.jpg
content-type => image/jpeg
data => &w`l *� m :��mF�΄�A�4d��

How would you embed this data in an HTML page with a Content-Type of
text/html? The <img> element needs a src attribute, which I don't
have, and the <object> element likewise needs a URI for the data
attribute.

I can certainly display the "data" from the database, but it's
character based data (clubs, diamonds, hearts, and spades) rather than
the nice, pretty picture that's really there. Is there a PM that can
take a binary and turn it into something that will look like an image
in a browser?

Thanks, CC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top