Over a year ago, I chose Imgur as an easy plug and play image host for PianoTell. It has worked well and served its purpose. Unfortunately, I'm now getting reports that Imgur is blocked in the UK.
I need to migrate to a CDN/S3 provider and there are a few things I need to solve:
- I need to get and download all the Imgur images linked on PianoTell.
- I need to upload all the Imgur images to the new CDN/S3.
- I need to replace all the Imgur links on PianoTell with the new CDN links.
For 1, unfortunately the Imgur API isn't being very friendly or is decommissioned, so I'm planning to run a SQL script to get all the links OR export the SQL DB to text and grep for the links. Then use curl to download them. Is there a better way I haven't thought of? (this is done now)
For 2, I just have to figure out the APIs and script the uploads. It will be a straightforward mapping like:
https://i.imgur.com/RFulutX.jpeg -> https://cdn.pianotell.com/imgur/RFulutX.jpeg
For 3, I could use some advice from folks here! How can I update all the Imgur links on PianoTell?
- I could somehow do this on the SQL side, though it feels risky. I'd have to run a script that updates everything in place. Are there any example SQL scripts for flarum that do such an update in place? Or I could do it in the text export and reimport the DB -- I've done this before and I know it works.
- Maybe I could update the links on the fly with an extension? Although this seems like it might be straightforward, it would be inefficient in the long run and might accidentally rewrite new Imgur links created by a poster.
Any other good ideas folks might have?
Thank you!