Gmail Photos Extension
Attach Google Photos directly from Gmail's compose window
Request Beta Access
We'll send you an invite to test Gmail Photos Extension.
Request sent!
You'll hear back soon.
Description
Attaching physical photos to email can be done for a variety of reasons, including data persistence, privacy, and the lack of Google Account access. This extension injects a Google Photos picker button into Gmail’s compose toolbar, letting users attach photos with a multiselect without downloading them first. Built on the Photos Picker API with a 4-method attachment injection fallback chain (hidden input, injected input, synthetic paste, synthetic drag-and-drop). Uses ARIA-based DOM selectors for resilience against Gmail’s frequent class-name changes.
Visual Demo
Key Technical Decisions
ARIA attributes over class names for Gmail selectors
Gmail's internal class names change without notice. Using role='dialog', aria-label, and data- attributes makes the selectors resilient to Gmail's frequent DOM updates.
New tab over iframe for Photos Picker
The Photos Picker API returns a pickerUri that must be opened for the user. Opening it in an iframe was unreliable across browsers. A new Chrome tab is the most robust approach, with a 2-second polling loop to detect completion.
Multiple attachment methods with fallback chain
Gmail provides no stable API for programmatic file attachment. Four methods are attempted in sequence: hidden file input, injected file input, synthetic paste event, synthetic drag-and-drop. If none work, files are offered for manual download.
Architecture
Content Script (Gmail DOM) → Background Service Worker (OAuth + Photos API) → Picker UI (extension page) → Gmail compose attachment injection
Tech Stack
By the Numbers
4-method attachment injection with graceful fallback
Built for post-deprecation Photos Picker API (March 2025)
Full privacy compliance — no data collected, stored, or transmitted