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

Storing Image Filenames and Paths

Status
Not open for further replies.

MikeMCSD

MIS
Jul 12, 2002
107
0
0
US
Hello,
I'm builing a store that has over 4000 products.
I need a thumbnail and a larger image for each product.

I plan on putting the images in folders by product categories: ex: /medals/stJoes/medal.jpg

Is it ok to store the image filename and path, like:
"/medals/stJoes/medal.jpg" as a field in the database?
I'll also need one for the the thumbnail as well.
Is there a better way of doing this?

This field will be used to load the image into a ASP.NET Datalist.

Thanks
 
That's what we do in our database. Use a varchar datatype and give it enough characters to store any potential file name and path you have.

Questions about posting. See faq183-874
 
That approach sounds fine to me... There are other ways you can accomplish it, such as using an Image or binary field type, and storing a copy of the image inside the database, but then you have to take into account displaying the image in a web page gets a lot trickier than
Code:
<img src=" & Pathname & ">
The way you're going about it is what I've always done, though, and I've never had any problems. Take this advice under consideration that I've never done any ASP.NET development, and therefore, don't have a clue as to how easy or hard it is in .NET...
 
Personally I go for the option of storeing everything in my database..

Strictly speeking though
in answer to your questions (in order)
Yes.
Not a problme, just include the image size in your path (relative to your website that is)

I used to do "website\images\fullsize....zyz.jpg"
"website\images\thumbs....zyz.jpg"
that way you olnly need to know it's name and what size you want.

IMHO yes, stick it in the db and take advantage of some of the really cool features of dot net like dynamic thumbs, image scaleing etc..

For a really bad example of how it could work..

all images are stored in a single table, there are no preset thumbs, they are generated when you select a category. All images are BIG (well ok bigger than you want to server up unless you have some time - limited pipe cable connection on upload) and are dynamicly scaled when you click on the size - they also support blowing up!

This could be really cool as it would allow you to do a drill down/blowup of a thumb to a huge hires image..

My 2c


Rob

PS sorry about how crude my site is, I just play with ideas there, and havn't done a whole lot of cleaning up...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top