The four "identify" calls could be done in one... Something like:
`list($height, $width, $y_resolution, $x_resolution) = explode(',', exec(escapeshellcmd("$identify -format \"%h,%W,%y,%x\" $file")));`... Dunno. I could live with it, as-is.