I love tinypng, I use it all the time. I even opted to support the developers by purchasing their Photoshop extension. Unfortunately, maintaining small file sizes is not as straight forward.
In most content management systems there is an option to upload images. Unfortunately, often they generate thumbnails. These are great for reducing bandwidth… If only they worked efficiently.
The problem is that because most image resize algorithms aren’t optimised for file-size, I have witnessed files produce thumbnails which have a smaller physical size but much larger file size. Unlike Jpeg, the algorithm doesn’t have a “quality” and therefore most implementations don’t take this into consideration.
My quest to solve this issue (and targeted towards WordPress) began.
One of the first things I needed to do was to find an appropriate piece of software which could work on linux in the aid of compressing pngs (while maintaining visually similar quality).
I’m quite the fan of WordPress. It has its faults, but it’s extremely easy to get going with. Unfortunately, one of the biggest issues is getting the permissions set up correctly.
In order to speed up this process, I’ve written a script which you can run on your server to automatically set things up the way they should be.
It’s a simple bash script which requires a little configuration. Once you’ve added in the right values for the owner/group of WordPress you’re good to go and should be able to run it.
Let’s get cracking!
Having a reliable WordPress system backup is important, having it outside the application is even more so. Combine that with full control and we have something pretty awesome going on.
The file structure I like to have is:
www/ backups/ <-- Backup location html/ <-- WordPress location scripts/ backup.sh <-- This file
And we will create the backup.sh script. This assumes that you have the WP CLI and tar utilities installed.