function Dwoo_Plugin_makeThumb(Dwoo $dwoo, $file = '', $prefix = '', $height = 300, $width = 200, $method = 'fit', $overwrite = false) { if ($file == '') { return false; } // check if the file contains the Path to the image $file = str_replace(CAT_URL, CAT_PATH, $file); $file = strpos($file, CAT_PATH) === false ? CAT_PATH . $file : $file; // Set some values $temp_path = CAT_PATH . '/temp/' . MEDIA_DIRECTORY . '/'; $temp_url = CAT_URL . '/temp/' . MEDIA_DIRECTORY . '/'; $info = pathinfo($file); $new_path = CAT_Helper_Directory::sanitizePath($temp_path . $prefix . $info['filename'] . '_' . $width . '_' . $height . '.' . $info['extension']); $new_url = str_replace(CAT_PATH, CAT_URL, $new_path); // Create temp directory, if the folder doesn't exist if (!file_exists($temp_path)) { CAT_Helper_Directory::createDirectory($temp_path, NULL, true); } // Create the file, if the file does not exist or overwrite is set to true if (!file_exists($new_path) || $overwrite == true) { CAT_Helper_Image::getInstance()->make_thumb($file, $new_path, $height, $width, $method); } return $new_url; // end make_thumb() }
/** * get instance; forwards to login page if the user is not logged in * * @access public * @return object **/ public static function getInstance() { if (!self::$instance) { self::$instance = new self(); } return self::$instance; }
function make_thumb($source, $destination, $size) { return CAT_Helper_Image::getInstance()->make_thumb($source, $destination, $size); }
/** * * @access public * @return **/ public static function check() { if (!CAT_Helper_Image::check_gd() || !file_exists(CAT_PATH . '/modules/lib_securimage/include/securimage.php')) { return self::wbstyle_check(); } else { return self::securImage_check(); } }