Found this pure-PHP Camo clone that I’ll use for my Microsub reader/Monocle fork, instead of a self-hosted image proxy. Pros: I’m _almost_ able to run the entire thing on a dead-cheap shared hosting environment. Cons: I _still_ need a caching proxy that’s able to resize and crop avatars, for now. (Ideally, though, the Microsub server would do all that. [No? Well, maybe not.])



Works well. Had to supply a user agent string to work around some hosts replying with a 403 Forbidden, and work around an oversight in the original code regarding HTTP status codes (`fopen` and friends follow redirects, which is _good_, but also means you may very well encounter valid image data in combination with a[n initial] 302). And added a sort of resizing option, which leads down a quite different path, and stores the outcome to disk.

And another one. Image URLs that end in a trailing slash—yes, those exist—now work as well.

Show thread
Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!