/** * Creates an instance defining the cache directory * * @param string $file file to be handled * @param int $w image width * @param int $h imege height * * @return ImageHandler */ private function _createInstance($file, $w = null, $h = null) { $full_file_path = $this->_public_dir . $file; $image = new ImageHandler($full_file_path, $w, $h); $image->setCacheDir($this->_cache_dir); $image->setFileCallback(function ($full_file_path) { $relative_file_path = str_replace($this->_public_dir, '', $full_file_path); return $relative_file_path; }); return $image; }