Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Getting an Image from the Web?

Getting an Image from the Web?
Thread Tools
zachs
Mac Elite
Join Date: May 2002
Location: New York City
Status: Offline
Reply With Quote
Mar 23, 2003, 10:38 AM
 
How would I go about retrieving an image file from the web, and then displaying it in an NSImageView?

Is it possible?

Thanks.
     
Truepop
Mac Elite
Join Date: Mar 2003
Status: Offline
Reply With Quote
Mar 23, 2003, 10:44 AM
 
There is an example of this (i think) with the apple developer tools but it is an applescript studio example. dilbert getter or something like that.

I don't know if that helps.

     
zachs  (op)
Mac Elite
Join Date: May 2002
Location: New York City
Status: Offline
Reply With Quote
Mar 23, 2003, 12:21 PM
 
I got it.

For those who want to use it, it's:

Code:
- (IBAction)getImage:(id)sender { NSImage * picture; NSString *url = [urlField stringValue]; picture = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:url]]; if(picture) [imageView setImage:picture]; [picture release]; }
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 04:29 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,