Web Development

General discussion


embed graphics in html

By luther_atkinson ·
I have a database with graphics images stored as blobs. I want to be able to send those blobs to a web-browser client for viewing. for security reasons, I cannot put the image files themselves on the web server. Otherwise I could use the <img src="blah.png"> html tag.

I don't know enough to adequately find what HTML tags/techniques would do the trick. Need pointers.

Thank you.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

need server-side program

by Jay Eckles In reply to embed graphics in html

I have gone through a similar project - the images had to be in the database as BLOB fields instead of on the web server as files. The only way to access the photos in the database is to create a server side program - a CGI, a Java Servlet, whatever you're comfortable with. I will say that ASP is possible, but is a collossal pain for this particular task.

The server side program will access the database, select the image, then send a Content-type: image/png header, then send the raw bytes that make up the image. You'll call your server side program like this:
<img src="program?key=picid" ...>
program is the name of the server-side program. Key is a parameter name, and picid would be the value for the key - you'll use that in your program to select the correct picture. The elipsis represents the rest of the tag (alt attribute, for example).

Good luck.


Related Discussions

Related Forums