Hi David,
Thank you for using MSDN Newsgroup! My name is Steven, and I'll be
assisting you on this issue.
From your description, your current question is how to create an Image from
a remote site via the Url address such as
"
http://www.foobar.com/MyPictures/pic.jpg"
If there is anything I misunderstood, please feel free to let me know.
First , I'd like to confirm something on this issue:
Does the "create" you mentioned in your questoin means to create a Image
object(System.Drawing.Image) instance which contains the image stream of
the remote picture or just want to show a picture on a web page via its url
address?
If you just want to how a picture on a page via its Url address, then you
can use the "System.Web.UI.WebControls.Image" control or even just use the
"<img ..>" html element. As for the Image control, you can use its
"ImageUrl" property to specify a certain picture's Url address. Such as:
imgMS.ImageUrl =
"
http://support.microsoft.com/library/images/support/bnr_microsoft.gif";
If you use the "<img >" html element, you can specify a picture like below:
<img
src="
http://support.microsoft.com/library/images/support/bnr_microsoft.gif"
/>
Else case, if you want to retrieve a image stream from a remote site and
store into a "System.Drawing.Image"
class object. I think you need to consider Chad McCune's suggestion:
Using the WebClient class to get the remote file stream and store into a
Image object(System.Drawing.Image).
For example:
System.Net.WebClient wc = new System.Net.WebClient();
Stream sm =
wc.OpenRead("
http://support.microsoft.com/library/images/support/bnr_microso
ft.gif");
System.Drawing.Image img = System.Drawing.Image.FromStream(sm);
img.Save(Server.MapPath("MS.gif"));
Please check out the preceding items to see whether they are helpful. If
you feel my suggestions not quite suitable for your situation, please feel
free to let me know more about your requirement so as for me to search for
further resource to assist you.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)