Webpage Load Times
gordonjcp ╡ irl: jesus christ, scale your fucking images
My last post about the adventure to the Donmouth Local Nature Reserve turned out to have a total page size of 69.2MB. Oops.
I’m new to using Ghost as a blogging platform, and in the past blogging platforms have scaled images for me. It turns out that Ghost does not do this. There is currently an open issue on GitHub discussing this but I don’t think this feature will be appearing at any point soon.
Google have an Apache module, PageSpeed, that has some image processing features in it. I think actually, as image processing is a common task for web applications, it makes sense for the web server to be doing this as opposed to every application implementing its own methods.
Installing The Module
The PageSpeed module for Apache can be downloaded from here. They provide a .deb archive for Debian and so I went with this option. I wasn’t too happy about following their installation instructions though, so I did:
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.deb sudo gdebi mod-pagespeed-stable_current_i386.deb
Their instructions tell you to install the package with
dpkg and then fix the
dependency issues with
apt-get afterwards. I don’t like to leave apt in a
broken state for any length of time and so I used gdebi, which will resolve
dependencies and install the required packages before installing the new
gdebi is not available on your system, you can install it with:
aptitude install gdebi
The Module In Action
After some playing with this, no luck. It seems that in order to play with images the module needs to be able to see them in the filesystem. As Apache is reverse proxying Ghost, the module has to fetch these over HTTP and so there’s nothing it can do.
This was dissapointing.
As it seems that it’s not going to be possible to have dynamic image resizing on the fly, I went with another less elegant method:
mogrify -resize 900 DSC_*.JPG
I guess until Ghost is capable of doing image resizing on it’s own, I’ll have to just put a bit more thought in before uploading images with far higher resolution than is necessary. Maybe there’s a reason this functionality wasn’t in the web server and applications always did it their own way.
This post was syndicated on: