photoprism_integration
PhotoPrism Integration provides a robust, Service-Oriented Architecture (SOA) foundation for
integrating PhotoPrism, the AI-powered photo
management solution, with Drupal.
This module is designed primarily for developers who need a reliable, injectable service layer to build custom
integrations. It encapsulates the complexity of the PhotoPrism API into a clean PHP service, allowing you to focus
on building your features.
Key Features
- Service-Oriented Design: All API interactions are handled by the
photoprism_integration.clientservice. - Comprehensive API Coverage: Includes over 40 methods covering:
- Albums & Folders: Create, read, update, delete, and manage photos within albums.
- Photos: Search, retrieve metadata, manage favorites, and handle file operations.
- AI Features: Access data for People (Face Recognition), Places (Geo), and Labels
(Tags). - Organization: Interacts with Moments, Calendar, and Folder structures.
- Developer-Friendly: Built-in error handling, logging, and extensive documentation.
- Connection Testing: AJAX-powered configuration form to verify server connectivity instantly.
- Demo UI: Includes a basic album browser and gallery view to demonstrate the service
capabilities.
Service-Oriented Architecture (SOA)
The core of this module is the PhotoPrismClient service. Instead of providing a rigid UI, we provide the
tools you need to build exactly what you want—whether that's a custom block, a media library integration, or a sync
mechanism.
Usage Example
Inject the service into your Controller, Form, or Block:
$photoprism = \Drupal::service('photoprism_integration.client'); // 1. Check Server Status $status = $photoprism->getStatus(); // 2. Search for "Nature" photos $photos = $photoprism->searchPhotos('nature', ['count' => 10]); // 3. Create a new album $new_album = $photoprism->createAlbum('Summer Trip', 'Best photos from 2026'); $album_uid = $new_album['UID']; // 4. Add photos to the album $photoprism->addPhotosToAlbum($album_uid, [$photo_uid_1, $photo_uid_2]);
Configuration
- Navigate to Configuration > Media > PhotoPrism Integration.
- Enter your PhotoPrism Server URL (e.g.,
http://photoprism.local:2342). - Enter your Access Token or App Password.
- Click Test Connection to verify settings.
Requirements
- Drupal 9.4, 10, or 11
- A running instance of PhotoPrism
Usage with Docker
If running Drupal and PhotoPrism in Docker containers, ensure you use the internal Docker hostname (e.g.,
http://host.docker.internal:2342) for the server URL.