Correct upload with python pil paste. Add Image::getWatermark()
This commit is contained in:
@ -20,6 +20,8 @@ abstract class Image extends File
|
|||||||
|
|
||||||
protected static $sizes = array();
|
protected static $sizes = array();
|
||||||
|
|
||||||
|
protected static $watermarks = array();
|
||||||
|
|
||||||
public static function getClassName()
|
public static function getClassName()
|
||||||
{
|
{
|
||||||
return get_called_class();
|
return get_called_class();
|
||||||
@ -50,6 +52,11 @@ abstract class Image extends File
|
|||||||
return static::$sizes;
|
return static::$sizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getWatermark($size)
|
||||||
|
{
|
||||||
|
return (isset(static::$watermarks[$size])) ? static::$watermarks[$size] : false;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getMaxWidth()
|
public static function getMaxWidth()
|
||||||
{
|
{
|
||||||
return static::$max_width;
|
return static::$max_width;
|
||||||
|
@ -79,6 +79,16 @@ abstract class Upload
|
|||||||
. ' ' . self::getFilePath($image_variant));
|
. ' ' . self::getFilePath($image_variant));
|
||||||
ob_clean();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user