Groups | Blog | Home
all groups > asp.net > november 2003 >

asp.net : reading a jpg file and resizing it on the fly ?


Patrick Steele [MVP]
11/14/2003 3:50:20 PM
In article <OhV6X1uqDHA.512@tk2msftngp13.phx.gbl>, koen@brainsharp.net
says...
[quoted text, click to view]

"Creating an image from a URL"
http://weblogs.asp.net/psteele/posts/7533.aspx

--
Patrick Steele
Microsoft .NET MVP
Kevin Spencer
11/14/2003 5:13:11 PM
The problem is that you're using a method which gets a file from a file
system, not an HTTP request, which is what you need to get an image from a
URL. What you need to do is to use a WebRequest to download the image and
then you can work with it. Here is a reference in the MSDN Library online
which should help:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusinginternetrequestresponseclasses.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

[quoted text, click to view]
Hi there,

I want to read a jpg-file from a url (f.e.
http://someserverWhichIsNOTLocal/images/test.jpg), get the dimensions,
resize it, save it to my local disk on the webserver as a gif-image and next
show it on my own (mobile) pages. (Actually I'm reading some images from my
normal website, which is on another machine, resize them, and show them on
my mobile site ...).

The main problem lies in reading the image from a url ... can't seem to find
how I should do that.

I'd like to be able to do something like :
thumb =
System.Drawing.Image.FromFile("http://someserverWhichIsNOTLocal/images/test.
jpg")
But unfortunately that doesn't work.

Any ideas?

Thanks in advance.

Greetingz,
Koen Hoorelbeke
koen@brainsharp.net

Koen Hoorelbeke
11/14/2003 9:24:41 PM
Hi there,

I want to read a jpg-file from a url (f.e. =
http://someserverWhichIsNOTLocal/images/test.jpg), get the dimensions, =
resize it, save it to my local disk on the webserver as a gif-image and =
next show it on my own (mobile) pages. (Actually I'm reading some images =
from my normal website, which is on another machine, resize them, and =
show them on my mobile site ...).

The main problem lies in reading the image from a url ... can't seem to =
find how I should do that.

I'd like to be able to do something like :=20
thumb =3D =
System.Drawing.Image.FromFile("http://someserverWhichIsNOTLocal/images/te=
st.jpg")
But unfortunately that doesn't work.

Any ideas?=20

Thanks in advance.

Greetingz,
Koen Hoorelbeke
Koen Hoorelbeke
11/14/2003 11:52:36 PM
Great ! Just what I needed.

Tx !

Greetingz,
Koen.

[quoted text, click to view]
http://someserverWhichIsNOTLocal/images/test.jpg), get the dimensions,
resize it, save it to my local disk on the webserver as a gif-image and next
show it on my own (mobile) pages. (Actually I'm reading some images from my
normal website, which is on another machine, resize them, and show them on
my mobile site ...).
[quoted text, click to view]
System.Drawing.Image.FromFile("http://someserverWhichIsNOTLocal/images/test.
jpg")
[quoted text, click to view]

AddThis Social Bookmark Button