I’m in the process of creating a complete archive of every workflow I ever created for the Workflow app and updating each one for Shortcuts. As I was browsing through my old Workflow articles, I came across an interesting workflow I created in early 2015 called Photo Flashbacks. The main idea was simple enough: given Workflow’s ability to read the contents of the photo library, the workflow would filter a photo taken on the same day in previous years and preview it with Quick Look. That seemed like a fun project that I could pick up again and improve for the Shortcuts app.

On This Day

My new custom shortcut is called ‘On This Day’, and it can be used to find any number of photos for any number of years in the past. Want the shortcut to only show you a single photo taken on this day last year? Just add your preference at the beginning, and you’ll have a functional replica of dedicated “on this day” utilities from the App Store. Feeling a bit more nostalgic and looking to assemble a collage of 5 photos for each “same day” from the past 10 years? This is also possible by tweaking two numbers. The shortcut was designed to scale from individual shots to entire collections of photos; the final result will always be previewed in full-screen, and you can decide to save it to the Photos app or anywhere else with the share sheet. You can even activate the shortcut from Siri if you want (though due to memory consumption, it’ll always have to execute in the Shortcuts app).

As usual, let’s take a look at how this works in practice:

As I mentioned above, the shortcut also supports collections of photos from several years in the past:

Of all the custom shortcuts I’ve shared on MacStories since the release of iOS 12, this is possibly the most advanced and complex one. However, as was the case with my iPhone XS Frames shortcut, I tried to abstract complexity from the user experience as much as possible. You shouldn’t notice any of the image scripting happening behind the scenes, and the shortcut won’t ask you to manually pick images or modify them in any way.

After installing the shortcut, all you need to do is answer two import questions. These configure two ‘Number’ actions that tell the shortcut how many photos per day it needs to find and for how many years in the past. If you’re looking to have the classic “A photo from this day last year” experience, my recommendation is to enter “1” for both questions; doing this tells Shortcuts to search for photos from one year in the past and to only load one photo for that day.

One the import questions for this shortcut.

The two Number actions that control years and photos filtered by the Shortcuts app.

However, you’re also free to enter whatever you want, bearing in mind that the more years and photos per day you’ll ask Shortcuts to search and combine, the longer it’s going to take for the shortcut to complete. You can enter values such as “15 years, 5 photos per day” or “3 years, 10 photos per day”, and the shortcut will continue to work. Or you can ignore both import questions and manually modify the Number actions to contain ‘Ask When Run’, which will prompt you to manually enter values every time you run the shortcut. The choice is yours.

I don’t want to get into a technical explanation of every single action of this shortcut, but there are a few high-level themes and key ideas I’d like to highlight. First of all, this shortcut can only work if your photos have correct metadata for the ‘Date Taken’ parameter; Shortcuts is trying to find photos that match a specific date, so if they lack a date altogether, or if the date is incorrect, the shortcut won’t work. Furthermore, while location metadata is optional, the shortcut is best experienced with photos that have embedded data for the original location where they were taken – most pictures taken on an iPhone do. At the end of the shortcut, you’ll be presented with a nice message that sums up how many photos were found along with the names of all the cities where the pictures were taken.

The message displayed at the beginning of the shortcut (left) and the final results.

Perhaps more importantly, you can see that the shortcut applies a date overlay to each photo to communicate visually when it was taken. I’m both proud of how I was able to implement the date overlay and embarrassed by the fact that it’s a hack that gets the job done. Shortcuts cannot generate images that contain styled text and a custom shape like, say, Pixelmator or Affinity Photo. So to generate the date overlay, my shortcut uses some custom HTML that is converted to rich text, converted to PDF, and finally converted to an image. The shortcut then performs cropping on the image and applies a mask to make the date overlay look like a native “badge” that gets added on top of photos.

Creating the date overlay with HTML and custom styles.

Even better though, you’ll notice that the font used in the date overlay is a bold version of San Francisco. By default, Shortcuts doesn’t use this typeface when converting HTML to rich text. However, by using inline styles and the -apple-system property supported by WebKit, I was able to use the San Francisco typeface like a modern web browser would. Ideally, Shortcuts should offer a visual editor for creating images based on styled text, but until that happens I’m going to use this workaround.

Lastly, a note on filtering photos and combining multiple results in the same image. If you want to exclude certain albums from your search query, I suggest adding a filter for ‘Album is not…’ to the initial ‘Find Photos Where’ action.

You can remove results from specific albums.

This can be useful if you want to remove photos from shared photo streams or albums created by apps such as Instagram and WhatsApp.

You’ll also notice that, when dealing with multiple images that have to be combined in a grid, the shortcut will resize each photo to 800 pixels and crop it to a square format. The choice to make photos square was just a personal preference so I would end up with a grid where each image has the same size. If you’d rather keep the same format but still combine images, you can remove the ‘Crop Image’ action (shown above) and switch the final ‘Combine Images’ action to use the side-by-side setting.

Putting together this shortcut turned out to be more challenging than I initially expected. Besides old problems of Workflow that still haven’t been addressed in Shortcuts (e.g. lack of native text-to-image actions or folding for long blocks of actions), I also ran across new ones such as limited execution time for memory-intensive shortcuts when summoned in Siri.

Despite all of this however, ‘On This Day’ has become one of the shortcuts I run every morning soon after waking up. It’s nice to look back on pictures of my dogs when they were cute little puppies; I hope that others will be able to rediscover photographic memories and forgotten moments with this shortcut as well. You can download it below.