mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
add getAdditionalParams(), getInfo(), width of image can be passed
This commit is contained in:
parent
306555cd45
commit
43c0f626ea
|
@ -34,12 +34,22 @@ class SeedDMS_ConversionServiceImageToImage extends SeedDMS_ConversionServiceBas
|
|||
$this->timeout = 5;
|
||||
}
|
||||
|
||||
public function getInfo() {
|
||||
return "Convert with imagick php functions";
|
||||
}
|
||||
|
||||
public function getAdditionalParams() { /* {{{ */
|
||||
return [
|
||||
['name'=>'width', 'type'=>'number', 'description'=>'Width of converted image']
|
||||
];
|
||||
} /* }}} */
|
||||
|
||||
public function convert($infile, $target = null, $params = array()) {
|
||||
$start = microtime(true);
|
||||
$imagick = new Imagick();
|
||||
if($imagick->readImage($infile)) {
|
||||
if(!empty($params['width']))
|
||||
$imagick->scaleImage((int) $params['width'], 0);
|
||||
$imagick->scaleImage(min((int) $params['width'], $imagick->getImageWidth()), 0);
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' with image service took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||
|
|
Loading…
Reference in New Issue
Block a user