New topic: Load an Image from a URL
<http://forums.realsoftware.com/viewtopic.php?t=46339> Page 1 of 1 [ 6 posts ] Previous topic | Next topic Author Message simulanics Post subject: Load an Image from a URLPosted: Mon Dec 24, 2012 11:54 am Joined: Sun Aug 12, 2007 10:10 am Posts: 886 Location: Boiling Springs, SC Lets say the image is at http://realsoftware.com/image.png Is there a better method to load an image into a desktop canvas as a backdrop without first using an httpsocket to download the file to folderitem...and then load it? I'd like to skip the download and read the raw binary and possibly use Picture.getdata()?!?! Any idea or a handy function? _________________ Matthew A. Combatti Real Studio 2012 r1.2 Visit Real Studio Developer's Spot! Systems I Use: Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/ Windows Server 2011/CentOS 5.4 /ReactOS/SimOS ~All REAL Compatible~ Top simulanics Post subject: Re: Load an Image from a URLPosted: Mon Dec 24, 2012 11:57 am Joined: Sun Aug 12, 2007 10:10 am Posts: 886 Location: Boiling Springs, SC Nevermind I figured it out _________________ Matthew A. Combatti Real Studio 2012 r1.2 Visit Real Studio Developer's Spot! Systems I Use: Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/ Windows Server 2011/CentOS 5.4 /ReactOS/SimOS ~All REAL Compatible~ Top shaosean Post subject: Re: Load an Image from a URLPosted: Mon Dec 24, 2012 2:41 pm Joined: Mon Aug 15, 2011 10:25 pm Posts: 248 Feel like sharing for future generations? _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top charonn0 Post subject: Re: Load an Image from a URLPosted: Mon Dec 24, 2012 4:42 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 1051 Location: San Francisco, CA, USA If I were to guess, he probably downloaded into a MemoryBlock instead of a FolderItem: Dim g As New HTTPSocket Dim mb As MemoryBlock = g.Get("http://realsoftware.com/image.png", 5) Dim p As Picture = Picture.FromData(mb) _________________ Boredom Software Top simulanics Post subject: Re: Load an Image from a URLPosted: Mon Dec 24, 2012 5:32 pm Joined: Sun Aug 12, 2007 10:10 am Posts: 886 Location: Boiling Springs, SC charonn0 wrote:If I were to guess, he probably downloaded into a MemoryBlock instead of a FolderItem: Dim g As New HTTPSocket Dim mb As MemoryBlock = g.Get("http://realsoftware.com/image.png", 5) Dim p As Picture = Picture.FromData(mb) Adam seems to have hit the nail on the head before I could post. **The memory block could also be a string returned from the URL but memoryblock is the preferred "best practices" methodology -happy holidays everyone!!!! _________________ Matthew A. Combatti Real Studio 2012 r1.2 Visit Real Studio Developer's Spot! Systems I Use: Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8 Beta Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/ Windows Server 2011/CentOS 5.4 /ReactOS/SimOS ~All REAL Compatible~ Top shaosean Post subject: Re: Load an Image from a URLPosted: Mon Dec 24, 2012 8:56 pm Joined: Mon Aug 15, 2011 10:25 pm Posts: 248 thanks _________________ Real Studio 2012r1.1 | MacBook Pro i5, 10.6.8 | Windows 7 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 6 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
