|
@ -75,17 +75,17 @@ abstract class Upload |
|
|
) { |
|
|
) { |
|
|
$script_file_path = Config::get('PYTHON_PIL_PASTE')->script_file_path; |
|
|
$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) : ''; |
|
|
$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();
|
|
|
|
|
|
|
|
|
ob_start(); |
|
|
$code = null; |
|
|
$code = null; |
|
|
$command = $script_file_path |
|
|
$command = $script_file_path |
|
|
. $pil_options |
|
|
. $pil_options |
|
|
. ' ' . self::getFilePath($image_variant) |
|
|
. ' ' . self::getFilePath($image_variant) |
|
|
. ' ' . Config::get('PATH_WEB_ROOT') . '/' . $image->getWatermark($size); |
|
|
. ' ' . Config::get('PATH_WEB_ROOT') . '/' . $image->getWatermark($size); |
|
|
passthru($command, $code); |
|
|
|
|
|
|
|
|
passthru('exec 2>&1; ' . $command, $code); |
|
|
if ($code !== 0) { |
|
|
if ($code !== 0) { |
|
|
throw new ErrorException('Command PYTHON_PIL_RESIZE: ' . $command ); |
|
|
|
|
|
|
|
|
throw new ErrorException('Command PYTHON_PIL_PASTE exit with code "' . $code . '": ' . $command . PHP_EOL . 'Std out: ' . ob_get_clean() ); |
|
|
} |
|
|
} |
|
|
// ob_clean();
|
|
|
|
|
|
|
|
|
ob_end_clean(); |
|
|
} |
|
|
} |
|
|
self::defineSizeWidthAndHeight($image_variant); |
|
|
self::defineSizeWidthAndHeight($image_variant); |
|
|
$image->variants[$size] = $image_variant; |
|
|
$image->variants[$size] = $image_variant; |
|
@ -134,7 +134,7 @@ abstract class Upload |
|
|
if ($code !== 0) { |
|
|
if ($code !== 0) { |
|
|
throw new ErrorException('Command PYTHON_PIL_RESIZE exit with code "' . $code . '": ' . $command . PHP_EOL . 'Std out: ' . ob_get_clean() ); |
|
|
throw new ErrorException('Command PYTHON_PIL_RESIZE exit with code "' . $code . '": ' . $command . PHP_EOL . 'Std out: ' . ob_get_clean() ); |
|
|
} |
|
|
} |
|
|
ob_clean(); |
|
|
|
|
|
|
|
|
ob_end_clean(); |
|
|
} else { |
|
|
} else { |
|
|
if ($width || $height) { |
|
|
if ($width || $height) { |
|
|
if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { |
|
|
if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { |
|
|