reading a jpg file and resizing it on the fly ?

  • Thread starter Thread starter Koen Hoorelbeke
  • Start date Start date
K

Koen Hoorelbeke

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
(e-mail address removed)
 
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.

"Creating an image from a URL"
http://weblogs.asp.net/psteele/posts/7533.aspx
 
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/d.../cpconusinginternetrequestresponseclasses.asp

--
HTH,

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

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
(e-mail address removed)
 
Great ! Just what I needed.

Tx !

Greetingz,
Koen.

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 ...).
 
Back
Top