View Single Post
  #12 (permalink)  
Old April 14th, 2006, 11:24 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Before you send me that beer, you may want to consider the path you store in the database.

If you store something like /localhost in the database, on your machine things will work. However, this schema will break when you move your site to another machine and access it like http://www.yourdomain.com. In that case, localhost will no longer exist so your images will break.

That's why I suggested earlier to store images from the virtual root path.

So, if you browse to your site like this:

http://localhost/

and you access an image like this:

http://localhost/Images/MyImage.gif

then only store /Images/MyImage in the database. Once you move to YourDomain.com, you can still access the image with

http://www.yourdomain.com/Images/MyImage.gif where the italic part is the dynamic path from the database.

Hope this helps,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Reply With Quote