/** * 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); }
public static function init() { //--- handle image request $rex_media_manager_file = self::getMediaFile(); $rex_media_manager_type = self::getMediaType(); if ($rex_media_manager_file != '' && $rex_media_manager_type != '') { $media_path = rex_path::media($rex_media_manager_file); $cache_path = rex_path::addonCache('media_manager'); $media = new rex_managed_media($media_path); $media_manager = new self($media); $media_manager->setCachePath($cache_path); $media_manager->applyEffects($rex_media_manager_type); $media_manager->sendMedia(); exit; } }