diff --git a/Image.class.php b/Image.class.php index fce7b72..96c4df1 100644 --- a/Image.class.php +++ b/Image.class.php @@ -20,6 +20,8 @@ abstract class Image extends File protected static $sizes = array(); + protected static $watermarks = array(); + public static function getClassName() { return get_called_class(); @@ -50,6 +52,11 @@ abstract class Image extends File return static::$sizes; } + public static function getWatermark($size) + { + return (isset(static::$watermarks[$size])) ? static::$watermarks[$size] : false; + } + public static function getMaxWidth() { return static::$max_width; diff --git a/Upload.class.php b/Upload.class.php index cff16b1..5354fae 100644 --- a/Upload.class.php +++ b/Upload.class.php @@ -79,6 +79,16 @@ abstract class Upload . ' ' . self::getFilePath($image_variant)); ob_clean(); } + if ($image->getWatermark($size) && Config::get('PYTHON_PIL_PASTE')) { + $script_file_path = Config::get('PYTHON_PIL_PASTE')->script_file_path; + $pil_options = (isset(Config::get('PYTHON_PIL_PASTE')->pil_options) && Config::get('PYTHON_PIL_PASTE')->pil_options) ? ' ' . implode(' ', Config::get('PYTHON_PIL_PASTE')->pil_options) : ''; + ob_start(); + exec($script_file_path + . $pil_options + . ' ' . self::getFilePath($image_variant) + . ' ' . Config::get('PATH_WEB_ROOT') . '/' . $image->getWatermark($size)); + ob_clean(); + } } /**