picsum-photos
repository·main·Indexed 25 days ago
https://github.com/dmarby/picsum-photosA service providing stylish placeholder images for developers. Includes the image-service for image processing, the picsum-photos CLI for service configuration and management, and the image-manifest tool for updating image dimension metadata in JSON manifests.
What's inside picsum-photos
- Lorem Picsum is a service that provides easy-to-use, stylish placeholder images. It is designed to function as a 'Lorem Ipsum' equivalent for visual assets, allowing developers to quickly integrate placeholder photos into their projects.
Run the image-service CLI
mainThe
image-serviceis the primary entrypoint for the image processing service. It can be configured via command-line flags or environment variables prefixed withIMAGE_(due to the use ofenvy.Parse("IMAGE")).To run the service, provide the required
--storage-pathand--hmac-keyflags. The service supports both TCP (usinghost:portsyntax) and Unix domain sockets (using a file path syntax).Reference: image-service environment variables
mainThe service uses theenvylibrary to parse environment variables. All configuration options can be set using environment variables prefixed withIMAGE_.Reference the image-manifest CLI flags
mainTheimage-manifestcommand accepts the following flags to control input and output paths:Reference: picsum-photos CLI flags
mainThe following flags are available for thepicsum-photosbinary:Reference: image-service command-line flags
mainThe following flags are available for configuring theimage-servicebinary:Configure the picsum-photos CLI
mainThepicsum-photosapplication can be configured using command-line flags. These flags control network settings, service URLs, logging, database paths, and authentication. Environment variables prefixed withPICSUM_can also be used for configuration (parsed viaenvy).Use the image-manifest CLI to update image dimensions
mainThe
image-manifesttool updates an existing JSON image manifest by scanning a directory of images and extracting their width and height metadata. It reads a manifest file containing a list ofdatabase.Imageobjects, locates the corresponding.jpgfiles in the specified directory, decodes their dimensions, and overwrites the manifest with the updated metadata.Workflow:
- The tool reads the manifest file specified by
--image-manifest-path. - For each image ID in the manifest, it looks for a file named
{ID}.jpgin the directory specified by--image-path. - It extracts the
WidthandHeightfrom the image files. - It saves the updated list back to the manifest file with indented JSON formatting.
- The tool reads the manifest file specified by