Browse Source

Correct upload with python pil paste. Add Image::getWatermark()

master
Alexander Demidov 9 years ago
parent
commit
377d78128f
  1. 7
      Image.class.php
  2. 10
      Upload.class.php

7
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;

10
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();
}
}
/**

Loading…
Cancel
Save