COMMENT
Search your photo library for old photos taken on this day in previous years. The shortcut can look for photos from multiple years, with multiple photos per day. If more than one photo is found, photos are resized to square and combined in a grid.
COMMENT
How many years to look for old photos?
NUMBER
1.0

Number
COMMENT
How many photos per year?
NUMBER
1.0

Number
COMMENT
Check the number of years and use either the word "years" or "year" for the initial message.
VARIABLES
Get
Total Years
SCRIPTING
If
Input
Condition
TEXT
year

Text
SCRIPTING
Otherwise
TEXT
years

Text
SCRIPTING
End If

If Result
SCRIPTING
Show
Now looking for photos taken on this day over the past
Total Years
Year Word
.
I'm going to open the app to continue...
SCRIPTING
Continue in Shortcuts app
COMMENT
For each year, start repeat block.
SCRIPTING
Repeat
Total Years

Repeat Results
DATE
Current Date

Date
CALENDAR
Add
0
seconds
from
Date

Adjusted Date
CALENDAR
Format
Date
Options Under Construction

Formatted Date
CALENDAR
Format
Date
Options Under Construction

Formatted Date
COMMENT
Find photos for the year the Repeat block is currently iterating upon. To remove certain albums from the search, add filters to exclude albums. Note that these filters will apply to every year.
PHOTOS
Find
All Photos
where
All the following are true [{'class': 'filter-property', 'value': 'Date Taken'}, {'class': 'filter-operator', 'value': 'is'}, {'class': 'filter-benchmark', 'value': 'Now', 'glyph': '', 'UUID': ''}] [{'class': 'filter-property', 'value': 'Is a Screenshot'}, {'class': 'filter-operator', 'value': 'is'}, {'class': 'filter-benchmark', 'value': 'None'}]

Photos
VARIABLES
Set variable
Results
to
Input
COMMENT
Count photos found for each year used as filter.
SCRIPTING
Count
Items
in
Input

Count
SCRIPTING
If
Input
Condition
VARIABLES
Get
Results
SCRIPTING
Repeat with each item in
Input

Repeat Results
MEDIA
Get
Location
from
Image

Location
LOCATION
Get
City
from
Location

City
VARIABLES
Get
Cities
SCRIPTING
If
Input
Condition
NOTHING
Nothing
SCRIPTING
Otherwise
VARIABLES
Get
Details of Locations
VARIABLES
Add
Input
to
Cities
SCRIPTING
End If

If Result
VARIABLES
Get
Repeat Item 2
MEDIA
Get
Date Taken
from
Image

Date Taken
CALENDAR
Format
Date
Options Under Construction

Formatted Date
COMMENT
Create a group of years to display in a final message at the end. If the year is already contained in the variable, skip it.
VARIABLES
Get
Years
SCRIPTING
If
Input
Condition
NOTHING
Nothing
SCRIPTING
Otherwise
VARIABLES
Get
Formatted Date
VARIABLES
Add
Input
to
Years
SCRIPTING
End If

If Result
COMMENT
Start preparing the year overlay. The 80 number is the default value for each numeric character that later generates the Width value for Crop Image action.
VARIABLES
Get
Formatted Date
SCRIPTING
Count
Characters
in
Input

Count
MATHS
Number
×
80.0
Options Under Construction

Calculation Result
TEXT
<head>
<style>
h1 {
font-family: -apple-system;
font-weight: 800;
}
</style>
<h1>
Formatted Date
</h1>
</head>

Text
DOCUMENTS
Make rich text from
HTML

Rich Text from HTML
DOCUMENTS

PDF
MEDIA
Get images from
Input

Images
MEDIA

Cropped Image
MEDIA
Mask
Input
with
Rounded Rectangle
Shape

Masked Image
COMMENT
If searching for photos for 1 year and if the result is 1 photo, keep the original photo. Otherwise, resize and crop every photo to square to later assemble a grid.
VARIABLES
Get
Total Years
SCRIPTING
If
Input
Condition
VARIABLES
Get
Number of Photo Results
SCRIPTING
If
Input
Condition
VARIABLES
Get
Repeat Item 2
SCRIPTING
Otherwise
SCRIPTING
End If

If Result
SCRIPTING
Otherwise
VARIABLES
Get
Repeat Item 2
MEDIA
Resize
Image
to
800.0
x
Auto Height

Resized Image
COMMENT
Remove crop action below if you want to combine images side by side.
MEDIA

Cropped Image
SCRIPTING
End If

If Result
MEDIA
Overlay
Masked Image
on
Image

Overlaid Image
VARIABLES
Add
Input
to
Edited
SCRIPTING
End Repeat

Repeat Results
SCRIPTING
Otherwise
NOTHING
Nothing
SCRIPTING
End If

If Result
SCRIPTING
End Repeat

Repeat Results
VARIABLES
Get
Years
TEXT
Split
Text
by
New Lines

Split Text
TEXT
Combine
Text List
with
Custom
,

Combined Text
TEXT
Combined Text
Current Date

Text
VARIABLES
Get
Edited
SCRIPTING
Count
Items
in
Input

Count
COMMENT
Check the number of processed photos and use the word "photos" or "photo".
SCRIPTING
If
Input
Condition
TEXT
photo

Text
SCRIPTING
Otherwise
TEXT
photos

Text
SCRIPTING
End If

If Result
COMMENT
Check the number of processed photos and use the phrase "They were taken" or "It was taken".
VARIABLES
Get
Number of Processed Photos
SCRIPTING
If
Input
Condition
TEXT
It was taken

Text
SCRIPTING
Otherwise
TEXT
They were taken

Text
SCRIPTING
End If

If Result
COMMENT
Count locations fetched from photos and see if necessary to include a location phrase in the final Show Result action.
VARIABLES
Get
Cities