• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying jpeg images
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying jpeg images


  • Subject: Re: Displaying jpeg images
  • From: "Michael P. Rogers" <email@hidden>
  • Date: Sat, 9 Jun 2001 21:24:26 -0500

At 2:11 PM -0400 6/9/01, email@hidden wrote:

- (IBAction)refreshImage:(id)sender
{
NSImage *img;
NSURL *url = [NSURL URLWithString: @"http://www.somesite.com/cgi-
bin/image.pl"];

NSLog(@"url = %@", url);
img = [[NSImage alloc] initWithContentsOfURL: url];
NSLog(@"img = %@", img);
[MyImage setImage: img];
[img release];
}

Did you ever get an answer as to why this doesn't work? Here's what I know (which, to quote Michael Feldman, is not much ;-).

1. Your problem isn't with jpegs per se, those work fine.

2. As a test, a file in my local web site (/Users/me/Sites/images/Cone.jpeg) displayed via the file: scheme, but not the http: scheme. Could this mean that NSURL is only going to load local files? That would seem to be a *highly* limiting factor. But a quick "Yes" or "No" from somebody who knows at this point would be helpful.

NSURL conforms to NSURLHandleClient, which means it implements this method:

- (void) URLHandle:(NSURLHandle *)sender
resourceDidFailLoadingWithReason:(NSString *)reason

The description says that this is *sent* when the URL fails to load, but, um, not to whom. If I could get a handle (so to speak) on reason (which I am rapidly losing trying to figure this out :-) I would print it out. Hopefully that would provide some enlightenment.

Sorry I can't be of more help. One last interesting note. Through this code,

NSURL * earl = [NSURL URLWithString:@"http://localhost/me/images/cone.jpeg";];

id handyEarl = [NSURLHandle URLHandleClassForURL:earl];

I discovered that NSURLs are handled by NSHTTPURLHandle, but unfortunately I can find no documentation. I had hoped that it was a type of NSURLHandle (I mean, it certainly sounds like it), but it didn't respond to the failureReason method.

Good luck.

Michael
--
---------------------------------
Dr. Michael Rogers
e-mail: email@hidden
Phone: 217-424-6327
For information about Computer Science at Millikin University, visit http://math.millikin.edu
For information about astronomy, check out http://twincityamateurastronomers.org


References: 
 >Displaying jpeg images (From: email@hidden)

  • Prev by Date: Where's examples about handling file?
  • Next by Date: Re: Where's examples about handling file?
  • Previous by thread: Displaying jpeg images
  • Next by thread: Re: Displaying jpeg images
  • Index(es):
    • Date
    • Thread