<?php
if (isset($options) && $options) {
$width = $height = $options;
}
if (!isset($bg) || !$bg) {
$bg = '#fff';
}
if (substr($input,0,1) == '/') $input = substr($input,1);
$path_info = pathinfo($input);
$cropedFile = 'assets/images/croped/'.$width.'/';
if (!file_exists($cropedFile)) {
mkdir($cropedFile, 0700);
}
$cropedFile .= $path_info['basename'];
if (!file_exists($cropedFile)) {
$im = new Imagick($input);
$im->trimImage(0);
$im->writeImage($cropedFile);
}
$input = $cropedFile;
$output = $modx->runSnippet('phpthumbof', array('input' => $input, 'options' => 'w='.$width.'&h='.$height.'&zc=0&bg='.$bg));
return $output;Обрезка пустых областей картинки
03 ноября 2015, 15:41
Объектная
0 комментариев