Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Load and Save Image

Posted on 2008-06-09
3
Medium Priority
?
968 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
[X]
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
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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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