4th December 2018
Ive moved my site over to Gatsby!
18th August 2016
My aproach to WordPress theme development.
22nd July 2016
RADIUS authentication for wireless networks using NAP in Windows Server 2012R2.
WP-Camo is a WordPress plugin I wrote for Ed-IT Solutions. It was designed to fix 2 issues we had with the WordPress sites that we where building.
We use HTTPS for all the sites that we host. This gives us all the security and privacy of HTTPS as well as letting us get better performance through http/2.
Our issue here was with hotlinking resources from other sites. I make sure that any off-domain resources used in themes and plugins are loaded over https but when the user is adding content to the site is another matter.
A common issue I’ve had is with badges that the clients want on pages of thier sites. It’s easy, the badge owner will proclaim, just put this code on your page. Cue the site loading http://somegroup/logo.jpg to a mixed content error.
Long term I will come along and download, upload and relink the image so its hosted on server with the site but in the short term I’d like the site to not throw mixed content errors at the users trying to see it.
Our other big niggle was with images on un-trusted sites. Mainly Facebook, which in schools is blocked for all pupils and most staff. We had these big holes in the layout where images from the Facebook feed should be.
We can’t ask schools to unblock Facebook so that thier sites look right and I didn’t want to have the themes do error detection and swap out the image etc…
THe only solution I could come up with was the proxy the images through the site so that instead of https://fbcdn.com/someimage.jpg its https://www.school.county.sch.uk/wp-content/wp-camo/hash.jpg which is an allowed URL.
This is similar to how GitHub handles images using camo.
WP-Camo does everything we need it to and does it without any noticable performance loss.
As of 1.0.0 instead of proxying the request on demand like camo does, WP-Camo now does all the work during the
apply_filters call. WP-Camo requests the image and saves it into the
wp-content/uploads/wp-camo directory and returns that URL from the filter.
One of the great features of WordPress’ filters is that if there are no filters for the given name the original data is returned. This lets us use the WP-Camo filter everywhere we might need it without having to worry that the clients site might not have the WP-Camo plugin installed.
All content is my own unless otherwise stated.
My content is licensed under the CC-BY-NC-SA 4.0 license