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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Images and sql server

Status
Not open for further replies.

mohrorless

Programmer
Mar 5, 2002
52
US
Hi All!!!!!!!

Quick question, or maybe not....

I am working on my 1st CF project and I need to be able to allow the users to indicate an image file to be saved into an image data type in sql server.

My problem is that the only code that I have been able to find on working with images has the image beng copies to the server and refered to from the database, not actually being saved into the database.

Any help or suggestions would be greatly appreciated.

Thanks!!

John


[spidey] [americanflag] [unclesam]
 
Actually, storing the image on the server and keeping a record of it in the database is the best route to take. Using the "image" datatype can be nasty. Is there any particular reason that you need to save the images in the database?



Hope This Helps!

Ecobb

"My work is a game, a very serious game." - M.C. Escher
 
Thanks for getting back. We are writing an app to track the instances of graffiti and vandalism and in order to help establish patterns and enable the people that did not work each case to see the vandalism/graffiti we need to be able to display it for them. One of our problems is that the CF server is an older server and does not have a huge amount of storage room available to store the individual image files. However, the SQL servers we have are like the Grand Canyon - big and empty - plenty of room to store stuff in an image table. The hope is to be able to do it that way if possible. Of course, everywhere I look it seems like the answer is to store the files individually and to save the location in the table.

[spidey] [americanflag] [unclesam]
 
Space would definately be a concern, especially if you have a lot of images. One thing to remember about SQL Server's Image datatype is that it's going to store the image as binary code. According to SQL Server's Books Online "Binary data consists of hexadecimal numbers. For example, the decimal number 245 is hexadecimal F5...Columns of image data can be used to store variable-length binary data exceeding 8 KB, such as Microsoft Word documents, Microsoft Excel spreadsheets, and images that include bitmaps, Graphics Interchange Format (GIF), and Joint Photographic Experts Group (JPEG) files."

In all honesty, I've never tried it so I can't tell you how to get the image into the database. Personally, I think the real task would be trying to pull the binary code out of the database and then convert it back to an image. Sorry I couldn't be of more assistance.



Hope This Helps!

Ecobb

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top