473,800 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading a jpg file and resizing it on the fly ?

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://someserverWhich IsNOTLocal/images/test.jpg")
But unfortunately that doesn't work.

Any ideas?

Thanks in advance.

Greetingz,
Koen Hoorelbeke
ko**@brainsharp .net
Nov 17 '05 #1
3 1464
In article <Oh************ *@tk2msftngp13. phx.gbl>, ko**@brainsharp .net
says...
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://someserverWhich IsNOTLocal/images/test.jpg")
But unfortunately that doesn't work.


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

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 17 '05 #2
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/de...nseclasses.asp

--
HTH,

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

"Koen Hoorelbeke" <ko**@brainshar p.net> wrote in message
news:Oh******** *****@tk2msftng p13.phx.gbl...
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://someserverWhich IsNOTLocal/images/test.
jpg")
But unfortunately that doesn't work.

Any ideas?

Thanks in advance.

Greetingz,
Koen Hoorelbeke
ko**@brainsharp .net
Nov 17 '05 #3
Great ! Just what I needed.

Tx !

Greetingz,
Koen.

"Patrick Steele [MVP]" <pa*****@mvps.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <Oh************ *@tk2msftngp13. phx.gbl>, ko**@brainsharp .net
says...
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://someserverWhich IsNOTLocal/images/test.
jpg") But unfortunately that doesn't work.


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

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2335
by: riki | last post by:
Hi, i have a big problem...i'm using one jscript for resizing of all of my pics in popUp...in main html i'm having many little pics and clicking on them they open in popUp and resize to larger version of the same pic. now, it works fine and sometimes when i click on little one it doesn't resize well... this is the code: main.html
6
5653
by: Foxy Kav | last post by:
Hi, another question from me again, i was just wondering if anyone could give me a quick example of reading data from a file then placing the data into an array for some manipulation then reading that array back into another file. I've tried, but i can only read the data and place it on the screen, i cant get it into an array. Any help would be helpful.
8
2906
by: Darsant | last post by:
I'm currently reading 1-n number of binary files, each with 3 different arrays of floats containing about 10,000 values a piece for a total of about 30,000 values per file. I'm looking for a way to load them all into memory. I've tried using vector pushback with reserving, but it was horribly slow. The current method I am using is upon opening the file and reading the number of values, resizing the vectors (I have 3, one for each data...
12
2264
by: AMT2K5 | last post by:
Hello. I have a file (for a school assignment) with the following format and delimiter format. Each record in the file has the following format: 123423454567987,29873,James,Ha­rry,St. Louis,416-555-5555; "accountNumber,balance,lastNam­e,city,phoneNumber;" Each record is guranteed to be no longer than 350 characters. "balance" is no longer than 20 characters, "accountNumber" is exactly 15 characters and the total number of characters in...
11
17883
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to override them. But they all invoked when the control is in the middle of the resizing process. I'm not using breakpoints, I'm using trace to see which one is invoked and when.
1
2128
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image sizes are a lot bigger(in file size) than the actual image being uploaded. The actual image being uploaded was around 22000bytes The smaller resized image is 120000bytes Also on the web when the resized image is displayed it starts out with a...
1
1448
by: Stephen | last post by:
Hi, I am using an Access database (OLE Object) and storing Image as a bytes after streaming. I am able to read it back as a stream and display it on the browser using the following code: Response.OutputStream.Write(fileData, 0, fileData.Length) it displays on the browser as an image, but I want to display it in an Image (web control image) so that I can manipulate its size. How can I do this?
7
2185
by: John Smith | last post by:
I want to read data from a file and assign it to a dynamically allocated array. I don't know the number of data in advance. My approach has been to read the file twice, the first time to determine its size, the second for the actual assignment. Is there a more efficient way?
21
3072
by: Stephen.Schoenberger | last post by:
Hello, My C is a bit rusty (.NET programmer normally but need to do this in C) and I need to read in a text file that is setup as a table. The general form of the file is 00000000 USNIST00Z 00000000_00 0 000 000 000 0000 000 I need to read the file line by line and eventually parse out each piece of the file and store in arrays that correspond to the specific
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10507
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9092
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.