Displaying a Chosen Photo
In some workflows it may be useful to be able to have the user choose the photo to use. To present a media picker dialog, from within any application, add the “Ask for Photos” action to the workflow. This action will return a reference to the file location of the chosen Photos image. To display the chosen photo in the Photos application window, add the “Display Referenced Photo” action after the “Ask for Photos” action in the workflow.
When the workflow is executed, the system media picker dialog will be presented:
When the user has selected an image from the picker window, the corresponding photo will be displayed full-size in the Photos window:
TIP: Since the result of the “Display Referenced Photo” action is a reference to the Photos item, this action can be followed by any of the Photos actions that take media items as their input, such as the “Export Media Items to Keynote” action that is used in this workflow, included with the examples installer, for creating a new image slide in Keynote:
The “Ask for Photos Helper” action
There is a known issue that occurs when the “Ask for Photos” action precedes the “Display Referenced Photo” action in a workflow. If the image chosen from the media picker (presented by the “Ask for Photos” action) has been previously edited, an incompatible file reference will passed as input to the “Display Referenced Photo” action, causing an error to occur.
The workflows examples installer provided on this website will install a special Automator action titled “Ask for Photos Helper” that you will place between the “Ask for Photos” action and the “Display Referenced Photo” action in your workflows. (⬇ see below )
This action will attempt to resolve any incompatible file reference and pass the reference type expected by the “Display Referenced Photo” action. This “translation” action will resolve references for edited images, but it will not work when the Photos library contains duplicates of the photo to be referenced.
NEXT TOPIC: Get Album Contents