imagewriter.php simplification.