Genie Image Generator
This project started as a bit of a downtime personal interest project after speaking to other developers responsible for building emails. The general premise is that due to emails being limited in terms of dynamic content (they can't contain any form of JavaScript, for example) the only way to be able to inject content in once an email campaign has been sent is through dynamic images which are built upon request.
I set about building an image generation tool ontop of Laravel, which was fast, flexible, and enabled developers to create image campaigns faster than they previously were able to using an older, more limited tool.
The tool I built works in a layer-based manner, building up images at request time, and utilises both a local file-based cache and integrates seamlessly with Amazons CloudFront caching. API calls are cached in a local database to in order to minimise the time required for processing and reduce the impact on third-party APIs which often impose rate limiting. As well as this, the memory footprint is kept to an absolute minimum, and only ever has a maximum of two image objects in memory at a time (in the case of building an image made up of other images). Typical images take around 50ms to generate on the server, which is only marginally above the time taken for Apache to serve up the image as a file. Also, once the image is generated, it's stored locally as a file and the tool will check for this (using the generation date as a cache guideline) before generating it again. Coupled with the CloudFront cache, this results in some very performant speeds for serving up dynamic images.
Among the features are:
- Generation of static images with dynamic content created from URL input
- File-based caching on generated assets to allow the server to utilise all of the RAM to generate the images, without sharing it with in-memory cache
- Generation of animated GIFs based on dynamic content
- Generation of animation slices with file caching to improve speed of generated animations
- Create images based on various social media sources, including Twitter and Instagram
- Ability to do basic drawing on images, using semi-transparent colours and simple shapes
- Ability to generate images that pull in Google Maps
- Generation of images that can alter themselves depending on the weather and include weather data, such as temperature
- Option to customise the system further with custom classes to extend the capabilities of the system
- Integration with cache headers in CloudFront that uses the config options to set cache headers
- Logging of errors and safe fallbacks for most errors that could occur
- Caching of API calls to prevent hitting rate limits
- Profanity filtering of text from sources like tweets
- Config-based campaign setup using Laravel config syntax to allow campaigns to be held in the repo
This is certainly one of the more interesting projects I've worked on recently, and I'm glad to have been at the forefront of jointly creating the idea and building the tool from the ground up.
Skills Used
The below are links back to the main portfolio list filtered by the selected skill.