Closed henare closed 8 years ago
I've now got an instance of the image-proxy deployed to play with http://fast-escarpment-97115.herokuapp.com/http%3A%2F%2Fwww.bmcc.nsw.gov.au%2Ffiles%2FABennett_photo.gif/100/100.jpeg
It does the resizing and transcodes all images to .jpeg .
I'm gonna now have a crack with the scraper at running images through the proxy and also saving a resized version of the image.
I'll look up the url scheme that gravitar use for predictable resizing.
I'll look up the url scheme that gravitar use for predictable resizing.
Hhmmm—Gravitar use the query string, which feels wrong for us since we're not responding to queries on the file, but rather returning a specific file.
Something like this seem quite predictable:
https://australian-local-councillors-images.s3.amazonaws.com/blacktown_city_council/len_robinson_80x88.jpg
The space replacement in our Popolo IDs is an underscore. As I suggested above, I'd use a different separator between the ID and the size so you know it's a different attribute, e.g. blacktown_city_council/len_robinson-80x88.jpg
.
Thanks @henare 👍
I've got this working with https://github.com/openaustralia/australian_local_councillors_images/compare/48935fa7717b...b4c765aabf9b , but I'm going to make it a bit more configurable to live up to what our readme says:
The code is fairly generic and all the configuration is stored in environment variable so you should be able to repurpose this quite easily.
Ok, I've made this much more configurable.
Here's an example of this in action. Hmmm. for some reason github wont show them. Here's the links
Original cached: https://australian-local-councillors-images.s3.amazonaws.com/bathurst_regional_council/greg_westman.jpg
Resized to 80 x 88: https://australian-local-councillors-images.s3.amazonaws.com/bathurst_regional_council/greg_westman-80x88.jpg
scraped from from:
Spiffy! :tada:
We're displaying them at 80x88 on PlanningAlerts. We should continue to fetch and cache the original image at the current URL and make a new one at
#{popolo_id}-80x88.jpg
.https://github.com/jpmckinney/image-proxy will probably come in handy.