Automatically generating images for narrowcasting purposes
Over at Pulseplay, one of our customers requested news items from their local outlets to be featured on their new narrowcasting solution.
Good old RSS feeds
Luckily enough, the local news outlet provides a good old RSS feed. Actually, 11 of the local outlets here in The Netherlands got together and started using the same Publication Platform: RegioGrid.
RegioGrid's platform provides a standardized RSS feed for us to periodically check for new news updates.
At Pulseplay we've built a little tool that reads the RSS feeds every couple of hours, and add all news items to our database table.
After reading the feeds and adding new news updates to the database, we're dispatching queued instances of an Image Generating job. Put simply, this loads a Browsershot instance, passing in one of a few templates we've designed.
Honestly, 'designed' is a bit of an overstatement.
An example of the images we generate would look something like this.
And now a more realistic example:
Source: RTV Noord
After generating images, they are briefly made publicly available so they can be downloaded by the narrowcasting playout server. We'll call an API endpoint that tells the server a new media item is available and provide the media URL and some more metadata.
Throughout the day the whole process happens a few times so the latest news is always available at our customer's venue!
I've never found a good way of programatically 'generating' images online - using PHP. For this purpose, using the Browsershot package by spatie seems perfect! I've not had any hickups in the whole process, and it's all been very wonderful.
Liked what your read? Spread the word: through Twitter of copy the link to other media.