Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Load and Save Image

Posted on 2008-06-09
3
Medium Priority
?
970 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 400 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 400 total points
ID: 21748882
0
 
LVL 8

Assisted Solution

by:YoungBonzi
YoungBonzi earned 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

926 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