views:

279

answers:

1

I have a Cocoa app that embeds a WebView. The WebView loads html elements including images. I have the textual links for the images (e.g. "http://www.domain.com/path/image.jpg"), but what I want is the image data itself so I can put it in an NSData object and ship it off to Growl. The WebView must have this data since it has downloaded and rendered the image. How can I get at it?

+3  A: 

Try this:

  1. Get the web view's main frame.
  2. Get the frame's data source.
  3. Ask the data source for the downloaded resource for the image URL.
  4. Get the resource's data.
Peter Hosey
Thank you! I thought this had to be possible, but I had no idea how to do it and probably wouldn't have figured it out. Thanks for Growl, too. It's awesome.
sam
On behalf of all Growl developers past and present, you're welcome. ☺
Peter Hosey