How a photo travels
From your camera roll to your friends’ phones, a log8 photo makes four stops. Here is each one, and why it is there.
Four stops
- On your phoneThe photo is resized so its longest edge is 1600 pixels and saved as a JPEG, and a 480-pixel thumbnail is made alongside it. The server never resizes anything.
- An upload intentThe app asks the API for permission to add a photo. The API checks you can add one here, a player or the person who logged the match, or the organiser or an entrant of a cup, and hands back two upload links, one for the photo and one for the thumbnail. They work for 15 minutes.
- Straight to storageThe phone uploads the bytes directly to private object storage. Our API never relays them, so a slow upload on a bad connection does not tie up a server.
- Commit and checkThe app tells the API it has finished. The API checks the files arrived at the size it expected, and hands the photo to a separate moderation service, where an image classifier looks at it.
Seen before it is checked
This is the trade-off we thought about longest. The check takes a little while, and a photo of the winning moment is worth most in the minutes after the game. So a photo is visible to the people who can see the match as soon as it is committed, while the check runs.
If the classifier flags it, the photo and its thumbnail are deleted from storage and it disappears. The thumbnail is checked too, and a flagged thumbnail takes the whole photo down. If the check cannot run, it is retried rather than skipped, and an upload that never finishes is cleared away after a day.
Who can see it
Photos live in private storage with no public address. To show one, the API first checks that you can see what it belongs to: the match’s players and the person who logged it, or the group it was posted to; the cup’s audience; or the people in the chat. Only then does it sign a link to the file.
Signed links expire. Ours last 48 hours, which is long enough for your phone to cache a photo and not download it every time you scroll past, and short enough that a link copied out of the app stops working.
Taking one down
The person who added a photo can delete it, and so can the person who logged the match or the organiser of the cup. The photo disappears from the app first, then the files are removed from storage.
Why it is built this way
- Small on the phone. Resizing before upload keeps photos quick to send on mobile data and quick to load for everyone else.
- Direct to storage. The API decides who may upload and stays out of the way of the bytes.
- Checked, then cleaned up. Every photo is checked, and nothing that fails the check is kept.
- Permission on every view. Links are made per request, after the check, so leaving a group or a cup takes its photos with it the next time the app asks.
The log8 team
