top | item 46054048

(no title)

catskull | 3 months ago

Cloudflare has their own image optimization and caching service, would be a good alternative: https://developers.cloudflare.com/images/transform-images/

I wrote a basic plugin for Jekyll to automatically prefix my images with this. Pretty much just set it and forget it: https://github.com/catskull/catskull.github.io/blob/master/_...

Am I missing something or is this way harder to do in Wordpress?

discuss

order

cr1st1an|3 months ago

The idea here is that WordPress will still host and transform the images (could have many stacked plugins as a pipeline) but the plugin will rewrite the final image's URL to be served by Cloudflare. So you can benefit of whatever pipeline you have in the server, and let the plugin use cloudflare at the edge.

weird-eye-issue|3 months ago

That is what Cloudflare already does by caching images

razingeden|3 months ago

so i could. say.

have a squid proxy on a $5 unmetered vps, referring to WP as a content-origin and then just use this to rewrite the image URL without using cloudflare at all?

(also possible with an apache directive but , doing it in WP could be useful)

and could you not .. just do the same for your $2.99 customers so you dont get a surprise $2000 bill or find yourself told by cloudflare that its time to pay up?

although if youre allowing uploads youre not in control of youd really need something like sightengine (or to roll your own) sooner or later to make sure no CSAM uploads and then theyll just get you in fees that way.

otherwise one person who does that might get your account canned and take every single blog using this service out

thats why id be a proponent of steering them to sign up and use their own CF R2 bucket , or self hosted minio (s3), or other s3 provider… or the squid thing for technical users who dont like cloudflare and its ilk. then theyre responsible for what they upload and host.

most wordpress static site plugins will configure the s3 hosting.

i just am not familiar with any that would easily let me plug in my own base URL for images. they probably exist… and if not then good job for tackling it. at the moment im going about this a different way and it works? but i wouldnt know how to go about packaging and shipping this up in a way thats accessible for everyone.

maybe a crude squid.conf generator you put your real wp url and your new cdn url into. but then youll want https on it too

i do know a lot of people would love to have “cdn” features without taxing the i/o and bandwidth on wordpress but who ALSO dont want to get cloudflare into their hosting for one reason or another. (im not there yet but i get it.)

the hug of death on stock wordpress is real which is why im already doing this in practice. with extra steps. (specifically a cloudflare rewrite rule for /wp-uploads/* to the alternate base URL which could also be done in vhost directives)

imo WP needs a third option under site URL and admin URL , for the base image URL.