Promised Files/ iPhoto

My app allows people to browse for images.
If they are tempted to use the Photos folder, they can pick a file but it fails to open as an image.
Im sure this is due to Iphoto and the like not showing ‘the actual file’ but some kind of shortcut to one.
How can I ensure that what they select is actually opened properly?
Is this something to do with “promised files” which I have heard mentioned?

Use “public.image” as file type name. This will add a “Media” section to the sidebar on the open dialog. There will be a “Photos” item, which – when selected – will show the iPhoto library items.

[code]Dim images As New FileType()
images.Name = “public.image”
images.Extensions = “jpg;jpeg”

Dim dlg As New OpenDialog()
dlg.Title = “Select an image file”
dlg.InitialDirectory = SpecialFolder.Pictures
dlg.Filter = images

Dim fi As FolderItem = dlg.ShowModal()

If fi Is Nil Then
BREAK // Error
End

Dim pic As Picture = Picture.Open(fi)[/code]
You can also narrow the search to movies or music and their libraries:

Dim movies As New FileType() movies.Name = "public.video" movies.Extensions = "avi;mov"
and

Dim images As New FileType() images.Name = "public.music" images.Extensions = "aiff;wav"

Thanks.
The issue appears to be that they DO get the media options, but the photo doesnt open reliably.

Promised files are part of the drag and drop functionality.

This is something else. Can you reproduce the error yourself?

Not after El Capitan…
Because MY photos no longer show up in Media.
Maybe something to do with Photos jumping on the iPhotos db

I used to see this in iPhoto and older OSC.
If I imported a pile of pictures into iPhoto, then tried to used the, the screen of thumbnails had some missing images for quite a while.
Like it was building up a set of thumbnails.
Once the image appeared, I would click on it, and it wouldnt work. Some minutes later it would.
My theory was that on first request it knew to unpack the image, and that by the time I asked again it had done so , perhaps in the temp folder…

Okay so the user is reading the photos from iPhoto… In that case, it’s a whole different kettle of fish.

The core usability method with Apple’s Photos, is that 3rd party apps should be Photos extensions, so the user never leaves “Photos”.

There is some declares (and probably a MBS plugin) that will show an Apple Media browser, which seems to work for both iPhoto and Photos, only on Yosemite. I can probably dig it up for you at some point.

with MBS Plugin we can show media browser (NSMediaLibraryBrowserControllerMBS class)

As Sam said, it is only allowed to access/change image files from within Photos if they are part of the Photo library. So you need to make a Photos extension.
Dont think this is possible with Xojo though.

BTW With the old iPhoto it was allowed to accesd/change images files. No idea why Apple nailed that door.

And in MBS Plugin we have classes to accept promised drags which is normally required to accept file drops from Photos app.

Thanks all.
I have the MBS plugin set, so I’ll see what I can assemble from that.

[quote]
with MBS Plugin we can show media browser (NSMediaLibraryBrowserControllerMBS class)[/quote]

Do I need two import methods… a normal File/Open and an ‘Import from media’ ?

Maybe theres an example somewhere.
The only help I can find at the moment says

NSMediaLibraryBrowserControllerMBS.Constructor
Function: Creates a new object for the shared library browser.
NSMediaLibraryBrowserControllerMBS.togglePanel
Function: Toggles the panel to hide/show.

If that turns on the ‘Media’ in the open dialog, I already have that visible.

The NSMediaLibraryBrowserControllerMBS is an extra floating window you can activate.
The user can drag & drop files from that panel to your windows.

That is completely different to normal file open dialog.

Well, that sounds pretty cool.
I’ll give it a try, thanks… :slight_smile:

This is not correct. You should be able to use the regular OpenDialog.

What Jeff is describing here:

[quote=249393:@Jeff Tullin]If I imported a pile of pictures into iPhoto, then tried to used the, the screen of thumbnails had some missing images for quite a while.
Like it was building up a set of thumbnails.
Once the image appeared, I would click on it, and it wouldnt work. Some minutes later it would.[/quote]
… is, that either there is an updated version of iPhoto updating the library (in the background) or the original photos are on external disks (maybe currently not connected) or on an iCloud drive and the iPhoto library only holds the thumbnails. iPhoto first needs to import the original size, because that is what you can access by OpenDialog.

[quote=249407:@Christoph De Vocht]As Sam said, it is only allowed to access/change image files from within Photos if they are part of the Photo library. So you need to make a Photos extension.
Dont think this is possible with Xojo though.[/quote]
Sadly it is not, however I have explored the possibility of creating a shell wrapper, that would then pass the data to a Xojo made external program. Trouble is I know of someone who tried this (not with Xojo) and Apple rejected it, saying it must all be combined within the Photos interface.

I can answer that; a great deal of people would use a one-trick pony to edit their photo and then later on decide that they didn’t like and want the original back. At which point the original was overwritten by the other app.

Now for the rest of us, this sucks big time. When you drag a photo from Photos into your application (via a promised item), Photos then creates a copy of the photo for you, sounds good so far, except there is no way to get the RAW image from Photos. When testing our apps which are designed to work with RAW, Photos will only give me it’s shitty rendered JPEGS from the RAW.

The only Apple approved way to get the RAW files is to use a Photos Extension; which means re-writing our apps in Obj-C or Swift. I’ve toyed with a unapproved of using what little meta data they give me to reverse the process and dig out the RAW image. Doesn’t work all the time :frowning:

At this point, with the increased competition and reduced earnings per unit, we’re on the verge of throwing the towel in with Photo apps.

We have found this to be unreliable; had a great deal of customers complain that since they upgraded their OS to El Capitan, they can’t open Photos from Photos through the open dialog. Not had it occur here, but since we’re used to better photo editor, we don’t use Photos that much anymore. The wife refuses to upgrade from Mavericks, using Photos as one excuse. She say iPhoto is much better for quick edits than Photos.

[quote=249435:@Jeff Tullin]Well, that sounds pretty cool.
I’ll give it a try, thanks… :)[/quote]
It is pretty cool and with a bit of extra hacking, it possible to actually embed it into your apps main interface, although I’ve confess I’ve not tried, I was just happy to have a reliable method of letting my customers select their photos from Apple’s Photos.

tl;dr Either Apple knows they fucked up and don’t care; or Time Cook has decided to reduce competition with Adobe. After all, most Ex-Aperture users that I have talked with have dumped Photos and gone to Lightroom. I tried, but I hate Lightroom…

It sounded cooler than it was… :slight_smile:
When I managed to get the window to appear, it obviously offered all kinds of media, most of which are not relevant.

There appear to be no options to that MBS call … most likely because there are none in the API it is calling.
(and I was lucky to find the 2-line docs that say more or less ‘to create one, create one’, and ‘to toggle the panel, toggle the panel’)

I dont want to use it, so my docs will say ‘Note: this product does not interface with Photo. Please use real pictures’ or words to that effect.

Nice write :slight_smile: