Rewrite PHP in cleanPNGs to sort images

PHP now sorts the images before drawing them. Also add headers to the
HTML generated.