Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Load and Save Image

Posted on 2008-06-09
3
964 Views
Last Modified: 2012-06-22
Hello, how can I load an image on another server and save it onto my server?  I tried the code below but fromfile doesnt accept URIs as a property.  Should I use httpwebrequest?  How can this be done?

        Dim originalImage As System.Drawing.Image
        originalImage = System.Drawing.Image.FromFile("http://domain.com/images/logo.jpg")
        originalImage.Save(...)

Thanks Very Much!
0
Comment
Question by:grogo21
3 Comments
 
LVL 14

Accepted Solution

by:
rachitkohli earned 100 total points
ID: 21748842
Am writing a rough code.. alter it for accuracy..

     Dim myReq As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
     Dim myResp As WebResponse = myReq.GetResponse()
   
     Dim stream As Stream = myResp.GetResponseStream()
     myResp.Close()

' Now use stream object for creating the image.
        Dim bm As Image
        bm=image.FromStream(stream)

0
 
LVL 18

Assisted Solution

by:Ajay Sharma
Ajay Sharma earned 100 total points
ID: 21748882
0
 
LVL 8

Assisted Solution

by:YoungBonzi
YoungBonzi earned 100 total points
ID: 21749353
simple way:
program a way to set the url and localFile variables
myWebClient.DownloadFile(url, localPath & localFile)
        Imports System.Net
----------------
 
        Dim myWebClient As New WebClient()
        Dim url As String = "http://www.google.com/intl/en_ALL/images/logo.gif"
        Dim localPath As String = Server.MapPath("Your_Image_Folder\")
        Dim localFile As String = "some_image.gif" 
 
        myWebClient.DownloadFile(url, localPath & localFile)

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question