img.php create a log entry if cache dir is not writeable and image does not exists
remove php-tags at the end of the files and added a check if the cache dir exists