Need help displaying JPG where filename is from DB Query

L

Lloyd Sheen

I have a list of JPG's which are found in a SQL Server database. When the
page selects a certain piece of data it will refer to the file system
(resident on IIS server with a virtual directory) and files contained within
a certain folder. I have been trying for quite a while to set the ImageURL
of an image control to the correct information.

I have googled till my mind hurts but can find nothing to help. I have even
tried to copy the jpg file to a temppics folder under my site to make that
work with no luck. Just the gif showing the file does not exist.


For example this is the filename of one of the jpgs:

D:\My Music\Classic Rock\Devo - Oh, No! It's Devo\Devo - Oh, No! It's
Devo.jpg

I put this into the ImageURL of the image control. When I look at the
properties of the image from the displayed page the URL ends up being
Devo%2520-%2520Oh,%2520No!%2520It's%2520Devo.jpg.

I am very confused ( a normal thing ) but really need a push in the right
direction here.

Thanks

Lloyd Sheen
 
L

Lloyd Sheen

Steve C. Orr said:
Here I've detailed all the steps you need to store and retrieve images in
a sql server database:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

Steve,

Thanks for the quick reply. I guess my explain is not good. I have
only the filenames in the database. The database is used to speed access to
the info rather than using the filesystem.

When I get a filename of a jpg I want to display the jpg as part of an
aspx page. I have an image control and just want to set the ImageURL
property to get it to show.

All files are under a virtual directory under IIS 7.

Lloyd Sheen
 
L

Lloyd Sheen

Peter Bromberg said:
string imgName = imageFromDatabaseRow["image"];
ImageControl.ImageUrl =ResolveUrl("images/"+imgName);


Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
Steve,

Thanks for the quick reply. I guess my explain is not good. I have
only the filenames in the database. The database is used to speed access
to
the info rather than using the filesystem.

When I get a filename of a jpg I want to display the jpg as part of
an
aspx page. I have an image control and just want to set the ImageURL
property to get it to show.

All files are under a virtual directory under IIS 7.

Lloyd Sheen

Ok here is example:

From database I get the folder name and then pickup the filename using
System.IO. The code I am using is below and then followed by the watch
values during debugging:

Dim url As String =
d.GetImageURL(Me.ListOfArtists.SelectedItem.ToString,
Me.ListOfCDs.SelectedItem.ToString, Request)
Me.CDImage.ImageUrl = ResolveUrl(url)


url "D:\My Music\Best Of\Abba - The Complete
Singles Collection\Abba - The Complete Singles Collection.jpg" String
cdimage.ImageUrl "D:\My Music\Best Of\Abba - The Complete Singles
Collection\Abba - The Complete Singles Collection.jpg" String


There is no change to the url by using the ResolveURL so right now I am at a
loss. I am trying to get this to work both in Dev and for an ISS 7 hosted
site. Since I am on Vista and cannot get IIS 7 to talk to VS 2005 I need to
dev and then publish. The virtual directory that the files sit under does
not exist on the VS 2005 dev server so I am having problems resolving all of
this.

Thanks.

Lloyd Sheen
 
G

Guest

ok. Well, it really gets a lot easier when you create a virtual directory in
IIS that points to the images folder, wherever it may be. then the path will
always be "images/filename.ext".
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
Peter Bromberg said:
string imgName = imageFromDatabaseRow["image"];
ImageControl.ImageUrl =ResolveUrl("images/"+imgName);


Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
message Here I've detailed all the steps you need to store and retrieve images
in
a sql server database:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net



I have a list of JPG's which are found in a SQL Server database. When
the
page selects a certain piece of data it will refer to the file system
(resident on IIS server with a virtual directory) and files contained
within a certain folder. I have been trying for quite a while to set
the
ImageURL of an image control to the correct information.

I have googled till my mind hurts but can find nothing to help. I
have
even tried to copy the jpg file to a temppics folder under my site to
make that work with no luck. Just the gif showing the file does not
exist.


For example this is the filename of one of the jpgs:

D:\My Music\Classic Rock\Devo - Oh, No! It's Devo\Devo - Oh, No! It's
Devo.jpg

I put this into the ImageURL of the image control. When I look at the
properties of the image from the displayed page the URL ends up being
Devo%2520-%2520Oh,%2520No!%2520It's%2520Devo.jpg.

I am very confused ( a normal thing ) but really need a push in the
right
direction here.

Thanks

Lloyd Sheen


Steve,

Thanks for the quick reply. I guess my explain is not good. I have
only the filenames in the database. The database is used to speed access
to
the info rather than using the filesystem.

When I get a filename of a jpg I want to display the jpg as part of
an
aspx page. I have an image control and just want to set the ImageURL
property to get it to show.

All files are under a virtual directory under IIS 7.

Lloyd Sheen

Ok here is example:

From database I get the folder name and then pickup the filename using
System.IO. The code I am using is below and then followed by the watch
values during debugging:

Dim url As String =
d.GetImageURL(Me.ListOfArtists.SelectedItem.ToString,
Me.ListOfCDs.SelectedItem.ToString, Request)
Me.CDImage.ImageUrl = ResolveUrl(url)


url "D:\My Music\Best Of\Abba - The Complete
Singles Collection\Abba - The Complete Singles Collection.jpg" String
cdimage.ImageUrl "D:\My Music\Best Of\Abba - The Complete Singles
Collection\Abba - The Complete Singles Collection.jpg" String


There is no change to the url by using the ResolveURL so right now I am at a
loss. I am trying to get this to work both in Dev and for an ISS 7 hosted
site. Since I am on Vista and cannot get IIS 7 to talk to VS 2005 I need to
dev and then publish. The virtual directory that the files sit under does
not exist on the VS 2005 dev server so I am having problems resolving all of
this.

Thanks.

Lloyd Sheen
 
L

Lloyd Sheen

Peter Bromberg said:
ok. Well, it really gets a lot easier when you create a virtual directory
in
IIS that points to the images folder, wherever it may be. then the path
will
always be "images/filename.ext".
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
Peter Bromberg said:
string imgName = imageFromDatabaseRow["image"];
ImageControl.ImageUrl =ResolveUrl("images/"+imgName);


Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




:


message Here I've detailed all the steps you need to store and retrieve
images
in
a sql server database:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net



I have a list of JPG's which are found in a SQL Server database.
When
the
page selects a certain piece of data it will refer to the file
system
(resident on IIS server with a virtual directory) and files
contained
within a certain folder. I have been trying for quite a while to
set
the
ImageURL of an image control to the correct information.

I have googled till my mind hurts but can find nothing to help. I
have
even tried to copy the jpg file to a temppics folder under my site
to
make that work with no luck. Just the gif showing the file does
not
exist.


For example this is the filename of one of the jpgs:

D:\My Music\Classic Rock\Devo - Oh, No! It's Devo\Devo - Oh, No!
It's
Devo.jpg

I put this into the ImageURL of the image control. When I look at
the
properties of the image from the displayed page the URL ends up
being
Devo%2520-%2520Oh,%2520No!%2520It's%2520Devo.jpg.

I am very confused ( a normal thing ) but really need a push in the
right
direction here.

Thanks

Lloyd Sheen


Steve,

Thanks for the quick reply. I guess my explain is not good. I
have
only the filenames in the database. The database is used to speed
access
to
the info rather than using the filesystem.

When I get a filename of a jpg I want to display the jpg as part
of
an
aspx page. I have an image control and just want to set the ImageURL
property to get it to show.

All files are under a virtual directory under IIS 7.

Lloyd Sheen

Ok here is example:

From database I get the folder name and then pickup the filename using
System.IO. The code I am using is below and then followed by the watch
values during debugging:

Dim url As String =
d.GetImageURL(Me.ListOfArtists.SelectedItem.ToString,
Me.ListOfCDs.SelectedItem.ToString, Request)
Me.CDImage.ImageUrl = ResolveUrl(url)


url "D:\My Music\Best Of\Abba - The Complete
Singles Collection\Abba - The Complete Singles Collection.jpg" String
cdimage.ImageUrl "D:\My Music\Best Of\Abba - The Complete Singles
Collection\Abba - The Complete Singles Collection.jpg" String


There is no change to the url by using the ResolveURL so right now I am
at a
loss. I am trying to get this to work both in Dev and for an ISS 7
hosted
site. Since I am on Vista and cannot get IIS 7 to talk to VS 2005 I need
to
dev and then publish. The virtual directory that the files sit under
does
not exist on the VS 2005 dev server so I am having problems resolving all
of
this.

Thanks.

Lloyd Sheen

Ok what I ended up doing is on the request I copy the jpg if it does not
already exist (they are not large) to a folder under my website. This in
combo with the ResolveURL gives the required result for both the dev and IIS
versions with no code change.

But this still does not answer my original question. How would I create a
URL which would point to a file which is no under my web site?

Thanks
Lloyd Sheen
 
G

Guest

to answer your unanswered question, a url to an image needs to be a valid
http-addressable url. It doesn't matter "where" that is, as long as it is a
web site where an <img src="http://www.wherever.com/images/yourimage.jpg" >
will work.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
Peter Bromberg said:
ok. Well, it really gets a lot easier when you create a virtual directory
in
IIS that points to the images folder, wherever it may be. then the path
will
always be "images/filename.ext".
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




Lloyd Sheen said:
message string imgName = imageFromDatabaseRow["image"];
ImageControl.ImageUrl =ResolveUrl("images/"+imgName);


Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




:


message Here I've detailed all the steps you need to store and retrieve
images
in
a sql server database:
http://SteveOrr.net/articles/EasyUploads.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net



I have a list of JPG's which are found in a SQL Server database.
When
the
page selects a certain piece of data it will refer to the file
system
(resident on IIS server with a virtual directory) and files
contained
within a certain folder. I have been trying for quite a while to
set
the
ImageURL of an image control to the correct information.

I have googled till my mind hurts but can find nothing to help. I
have
even tried to copy the jpg file to a temppics folder under my site
to
make that work with no luck. Just the gif showing the file does
not
exist.


For example this is the filename of one of the jpgs:

D:\My Music\Classic Rock\Devo - Oh, No! It's Devo\Devo - Oh, No!
It's
Devo.jpg

I put this into the ImageURL of the image control. When I look at
the
properties of the image from the displayed page the URL ends up
being
Devo%2520-%2520Oh,%2520No!%2520It's%2520Devo.jpg.

I am very confused ( a normal thing ) but really need a push in the
right
direction here.

Thanks

Lloyd Sheen


Steve,

Thanks for the quick reply. I guess my explain is not good. I
have
only the filenames in the database. The database is used to speed
access
to
the info rather than using the filesystem.

When I get a filename of a jpg I want to display the jpg as part
of
an
aspx page. I have an image control and just want to set the ImageURL
property to get it to show.

All files are under a virtual directory under IIS 7.

Lloyd Sheen


Ok here is example:

From database I get the folder name and then pickup the filename using
System.IO. The code I am using is below and then followed by the watch
values during debugging:

Dim url As String =
d.GetImageURL(Me.ListOfArtists.SelectedItem.ToString,
Me.ListOfCDs.SelectedItem.ToString, Request)
Me.CDImage.ImageUrl = ResolveUrl(url)


url "D:\My Music\Best Of\Abba - The Complete
Singles Collection\Abba - The Complete Singles Collection.jpg" String
cdimage.ImageUrl "D:\My Music\Best Of\Abba - The Complete Singles
Collection\Abba - The Complete Singles Collection.jpg" String


There is no change to the url by using the ResolveURL so right now I am
at a
loss. I am trying to get this to work both in Dev and for an ISS 7
hosted
site. Since I am on Vista and cannot get IIS 7 to talk to VS 2005 I need
to
dev and then publish. The virtual directory that the files sit under
does
not exist on the VS 2005 dev server so I am having problems resolving all
of
this.

Thanks.

Lloyd Sheen

Ok what I ended up doing is on the request I copy the jpg if it does not
already exist (they are not large) to a folder under my website. This in
combo with the ResolveURL gives the required result for both the dev and IIS
versions with no code change.

But this still does not answer my original question. How would I create a
URL which would point to a file which is no under my web site?

Thanks
Lloyd Sheen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top