Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datatype for a JPEG? 1

Status
Not open for further replies.

sazebac

Technical User
Apr 16, 2003
117
US
What datatype should I use for a JPEG image? What I'm going for is something similar to Amazon where a person searches for a book and is given the book info plus a picture of the book. I suppose all the pictures of all the books would be stored in a database. If I'm on the wrong track let me know. Thanks.
 
You can store JPEGs in your database -- you would use one of the BLOB types (
I strongly recommend, however, that you not store the JPEG in your database, but that you store the JPEG on your filesystem and store the filename in the database. If you are outputting to the web, I even more strongly recommend this.

If you store the JPEG data in your database, you must then write yourself the code for fetching the data, setting the correct content type, and streaming the data to the client.

If you store just the filename, then all you have to do is provide a reference to the filename. If you're using HTML as your output, it's just fetch the data and output a string like: <IMG src=[your fetched filename]>&quot;. Your web server will handle the streaming and the content-type for you.



Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top