$cache_filename = Filecache::retrieveValidFilename($image, $options); if (Filecache::has($cache_filename, $lifetime)) { // The cache has our file, get the full filepath $cached_image = Filecache::getPath($cache_filename); return Resp::inline($cached_image, basename($image), $lifetime); } else { // File is not cached, lets get a path $cache_image_path = Filecache::getPath($cache_filename); $imwg = Imwg::open($image); parseOptions($imwg, $opt); $imwg->save($cache_image_path); return Resp::inline($cache_image_path, basename($image), $lifetime); } } else { // caching is disabled $imwg = Imwg::open($image); parseOptions($imwg, $opt); return $imwg->display(); #$imwg->display(); #exit(); } } // No config file // Check if the image exists if (File::exists($image)) { return Resp::inline($image); } // No config and // no image found return Response::error('404'); });