function getImageCache($rex_img_file, $rex_img_type) { global $REX; $imagepath = $REX['HTDOCS_PATH'] . 'files/' . $rex_img_file; $cachepath = $REX['INCLUDE_PATH'] . '/generated/files/'; $image = new rex_image($imagepath); $image_cacher = new rex_image_cacher($cachepath); // create image with given image_type if needed if (!$image_cacher->isCached($image, $rex_img_type)) { $image_manager = new rex_image_manager($image_cacher); $image_manager->applyEffects($image, $rex_img_type); $image->save($image_cacher->getCacheFile($image, $rex_img_type)); } return $image_cacher->getCachedImage($rex_img_file, $rex_img_type); }
/** * Returns a rex_image instance representing the image $rex_img_file * in respect to $rex_img_type. * If the result is not cached, the cache will be created. */ public static function getImageCache($rex_img_file, $rex_img_type) { global $REX; $imagepath = $REX['HTDOCS_PATH'] . $REX['MEDIA_DIR'] . '/' . $rex_img_file; $cachepath = $REX['GENERATED_PATH'] . '/files/'; $image = new rex_image($imagepath); $image_cacher = new rex_image_cacher($cachepath); // create image with given image_type if needed if (!$image_cacher->isCached($image, $rex_img_type)) { $image_manager = new self($image_cacher); $image_manager->applyEffects($image, $rex_img_type); $image->save($image_cacher->getCacheFile($image, $rex_img_type)); } return $image_cacher->getCachedImage($rex_img_file, $rex_img_type); }