mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
V 3.5 RC 1
This commit is contained in:
33
lib/classes/binaryAdapter/image/resize.class.php
Normal file
33
lib/classes/binaryAdapter/image/resize.class.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Image Resize adpater for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_resize extends binaryAdapter_adapterAbstract
|
||||
{
|
||||
|
||||
protected $processors = array(
|
||||
'binaryAdapter_image_resize_sips',
|
||||
'binaryAdapter_image_resize_imagemagick',
|
||||
'binaryAdapter_image_resize_gd'
|
||||
);
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'Binary adapter image resizer';
|
||||
}
|
||||
|
||||
}
|
159
lib/classes/binaryAdapter/image/resize/gd.class.php
Normal file
159
lib/classes/binaryAdapter/image/resize/gd.class.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GD image resize processor for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_resize_gd extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
'size' => 200,
|
||||
'dpi' => null,
|
||||
'quality' => 75,
|
||||
'strip' => true,
|
||||
'autorotate' => true
|
||||
);
|
||||
protected $binary_name = 'GD';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param registry $registry
|
||||
* @return binaryAdapter_image_resize_gd
|
||||
*/
|
||||
public function __construct(registry $registry)
|
||||
{
|
||||
$this->binary = function_exists('imagecreate');
|
||||
if (!$this->binary)
|
||||
{
|
||||
throw new Exception('GD not installed');
|
||||
}
|
||||
parent::__construct($registry);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return binaryAdapter_image_resize_gd
|
||||
*/
|
||||
protected function set_option($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'dpi':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32767) ? null : $value;
|
||||
break;
|
||||
case 'quality':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 100) ? 75 : $value;
|
||||
break;
|
||||
case 'strip':
|
||||
$value = !!$value;
|
||||
break;
|
||||
case 'size':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32000) ? 200 : $value;
|
||||
break;
|
||||
}
|
||||
|
||||
parent::set_option($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$tech_datas = $origine->get_technical_datas();
|
||||
|
||||
$size = $this->options['size'];
|
||||
|
||||
if (!is_null($size) && !$origine->is_raw_image()
|
||||
&& $tech_datas[system_file::TC_DATAS_WIDTH] < $size && $tech_datas[system_file::TC_DATAS_HEIGHT] < $size)
|
||||
{
|
||||
$size = max($tech_datas[system_file::TC_DATAS_WIDTH], $tech_datas[system_file::TC_DATAS_HEIGHT]);
|
||||
}
|
||||
|
||||
$imag_original = imagecreatefromjpeg($origine->getPathname());
|
||||
|
||||
if ($imag_original)
|
||||
{
|
||||
$w_doc = imagesx($imag_original);
|
||||
$h_doc = imagesy($imag_original);
|
||||
|
||||
if ($w_doc < $size && $h_doc < $size)
|
||||
{
|
||||
$img_mini = imagecreatetruecolor($w_doc, $h_doc);
|
||||
imagecopy($img_mini, $imag_original, 0, 0, 0, 0, $w_doc, $h_doc);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($w_doc > $h_doc)
|
||||
$h_sub = (int) (($h_doc / $w_doc) * ($w_sub = $size));
|
||||
else
|
||||
$w_sub = (int) (($w_doc / $h_doc) * ($h_sub = $size));
|
||||
$img_mini = imagecreatetruecolor($w_sub, $h_sub);
|
||||
|
||||
imagecopyresampled($img_mini, $imag_original, 0, 0, 0, 0,
|
||||
$w_sub, $h_sub, $w_doc, $h_doc);
|
||||
}
|
||||
|
||||
if ($this->options['autorotate'])
|
||||
{
|
||||
switch ($tech_datas[system_file::TC_DATAS_ORIENTATION])
|
||||
{
|
||||
case 3:
|
||||
$img_mini = imagerotate($img_mini, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$img_mini = imagerotate($img_mini, 270, 0);
|
||||
$z = $w_sub;
|
||||
$w_sub = $h_sub;
|
||||
$h_sub = $z;
|
||||
break;
|
||||
case 8:
|
||||
$img_mini = imagerotate($img_mini, 90, 0);
|
||||
$z = $w_sub;
|
||||
$w_sub = $h_sub;
|
||||
$h_sub = $z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$quality = $this->options['quality'];
|
||||
|
||||
imagejpeg($img_mini, $dest, $quality);
|
||||
|
||||
imagedestroy($img_mini);
|
||||
imagedestroy($imag_original);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
170
lib/classes/binaryAdapter/image/resize/imagemagick.class.php
Normal file
170
lib/classes/binaryAdapter/image/resize/imagemagick.class.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ImageMagick image resize processor for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_resize_imagemagick extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
'size' => 200,
|
||||
'dpi' => null,
|
||||
'quality' => 75,
|
||||
'strip' => true,
|
||||
'autorotate' => true
|
||||
);
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_imagick';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return binaryAdapter_image_resize_imagemagick
|
||||
*/
|
||||
protected function set_option($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'dpi':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32767) ? null : $value;
|
||||
break;
|
||||
case 'quality':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 100) ? 75 : $value;
|
||||
break;
|
||||
case 'strip':
|
||||
$value = !!$value;
|
||||
break;
|
||||
case 'size':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32000) ? 200 : $value;
|
||||
break;
|
||||
}
|
||||
|
||||
parent::set_option($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$tech_datas = $origine->get_technical_datas();
|
||||
|
||||
$size = $this->options['size'];
|
||||
$width = isset($tech_datas[system_file::TC_DATAS_WIDTH]) ? $tech_datas[system_file::TC_DATAS_WIDTH] : null;
|
||||
$height = isset($tech_datas[system_file::TC_DATAS_HEIGHT]) ? $tech_datas[system_file::TC_DATAS_HEIGHT] : null;
|
||||
|
||||
if (!is_null($size) && !$origine->is_raw_image() && $width < $size && $height < $size)
|
||||
{
|
||||
$size = max($width, $height);
|
||||
}
|
||||
|
||||
$cmd = $this->binary;
|
||||
|
||||
$cmd .= ' -colorspace RGB -flatten -alpha Off -quiet';
|
||||
|
||||
if ($this->options['strip'])
|
||||
$cmd .= ' -strip';
|
||||
|
||||
$cmd .= sprintf(' -quality %s', $this->options['quality']);
|
||||
|
||||
if ($size)
|
||||
{
|
||||
$cmd .= sprintf(' -resize %sx%s', $size, $size);
|
||||
|
||||
if (in_array(
|
||||
$origine->get_mime(), array(
|
||||
'application/pdf',
|
||||
'application/postscript'
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
$cmd .= sprintf(' -geometry %sx%s', $size, $size);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->options['dpi'])
|
||||
{
|
||||
$cmd .= sprintf(' -density %sx%s -units PixelsPerInch'
|
||||
, $this->options['dpi']
|
||||
, $this->options['dpi']
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->options['autorotate'])
|
||||
{
|
||||
switch ($tech_datas[system_file::TC_DATAS_ORIENTATION])
|
||||
{
|
||||
case 3:
|
||||
$cmd .= ' -rotate 180';
|
||||
break;
|
||||
case 6:
|
||||
$cmd .= ' -rotate 90';
|
||||
break;
|
||||
case 8:
|
||||
$cmd .= ' -rotate -90';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$array = array(
|
||||
'image/tiff',
|
||||
'application/pdf',
|
||||
'image/psd',
|
||||
'image/vnd.adobe.photoshop',
|
||||
'image/photoshop',
|
||||
'image/ai',
|
||||
'image/illustrator',
|
||||
'image/vnd.adobe.illustrator'
|
||||
);
|
||||
|
||||
if (in_array($origine->get_mime(), $array))
|
||||
{
|
||||
$cmd .= sprintf(' %s %s'
|
||||
, $this->escapeshellargs($origine->getPathname(), '[0]')
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd .= sprintf(' %s %s'
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
}
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
153
lib/classes/binaryAdapter/image/resize/sips.class.php
Normal file
153
lib/classes/binaryAdapter/image/resize/sips.class.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SIPS image resize processor for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_resize_sips extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
'size' => 200,
|
||||
'dpi' => null,
|
||||
'quality' => 75,
|
||||
'strip' => true,
|
||||
'autorotate' => true
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param registry $registry
|
||||
* @return binaryAdapter_imageTransform_sips
|
||||
*/
|
||||
public function __construct(registry $registry)
|
||||
{
|
||||
throw new Exception('Need to work');
|
||||
try
|
||||
{
|
||||
$system = system_server::get_platform();
|
||||
if ($system !== 'DARWIN')
|
||||
throw new Exception('this adapter is not available on this platform');
|
||||
|
||||
$this->binary = new SplFileObject('/usr/bin/sips');
|
||||
|
||||
if (!$this->binary->isExecutable())
|
||||
throw new Exception('Sips is not executable');
|
||||
|
||||
parent::__construct($registry);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return binaryAdapter_image_resize_sips
|
||||
*/
|
||||
protected function set_option($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'dpi':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32767) ? null : $value;
|
||||
break;
|
||||
case 'quality':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 100) ? 75 : $value;
|
||||
break;
|
||||
case 'strip':
|
||||
$value = !!$value;
|
||||
break;
|
||||
case 'size':
|
||||
$value = (int) $value;
|
||||
$value = ($value <= 0 || $value > 32000) ? 200 : $value;
|
||||
break;
|
||||
}
|
||||
|
||||
parent::set_option($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$tech_datas = $origine->get_technical_datas();
|
||||
|
||||
$size = $this->options['size'];
|
||||
|
||||
if ($tech_datas[system_file::TC_DATAS_COLORSPACE] == 'CMYK')
|
||||
throw new Exception('this adapter does not work with CMYK');
|
||||
|
||||
if (!is_null($size) && !$origine->is_raw_image()
|
||||
&& $tech_datas[system_file::TC_DATAS_WIDTH] < $size && $tech_datas[system_file::TC_DATAS_HEIGHT] < $size)
|
||||
{
|
||||
$size = max($tech_datas[system_file::TC_DATAS_WIDTH], $tech_datas[system_file::TC_DATAS_HEIGHT]);
|
||||
}
|
||||
|
||||
$cmd = 'sips'
|
||||
. ' -s format jpeg'
|
||||
. ' -s formatOptions ' . $this->options['quality']
|
||||
. ' -Z ' . $size;
|
||||
|
||||
if ($this->options['dpi'])
|
||||
{
|
||||
$cmd .= ' -s dpiHeight ' . $this->options['dpi']
|
||||
. ' -s dpiWidth ' . $this->options['dpi'];
|
||||
}
|
||||
|
||||
if ($this->options['autorotate'])
|
||||
{
|
||||
switch ($tech_datas[system_file::TC_DATAS_ORIENTATION])
|
||||
{
|
||||
case 3:
|
||||
$cmd .= ' -r 180';
|
||||
break;
|
||||
case 6:
|
||||
$cmd .= ' -r 90';
|
||||
break;
|
||||
case 8:
|
||||
$cmd .= ' -r 270';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$cmd .= sprintf(' %s --out %s'
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
31
lib/classes/binaryAdapter/image/rotate.class.php
Normal file
31
lib/classes/binaryAdapter/image/rotate.class.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_rotate extends binaryAdapter_adapterAbstract
|
||||
{
|
||||
|
||||
protected $processors = array(
|
||||
'binaryAdapter_image_rotate_imagemagick'
|
||||
, 'binaryAdapter_image_rotate_gd'
|
||||
);
|
||||
|
||||
public function get_name()
|
||||
{
|
||||
return 'Binary adapter image rotator';
|
||||
}
|
||||
|
||||
}
|
92
lib/classes/binaryAdapter/image/rotate/gd.class.php
Normal file
92
lib/classes/binaryAdapter/image/rotate/gd.class.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GD image resize processor for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_rotate_gd extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
'angle' => 90
|
||||
);
|
||||
protected $binary_name = 'GD';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param registry $registry
|
||||
* @return binaryAdapter_image_resize_gd
|
||||
*/
|
||||
public function __construct(registry $registry)
|
||||
{
|
||||
$this->binary = function_exists('imagecreate');
|
||||
if (!$this->binary)
|
||||
{
|
||||
throw new Exception('GD not installed');
|
||||
}
|
||||
parent::__construct($registry);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return binaryAdapter_image_resize_gd
|
||||
*/
|
||||
protected function set_option($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'angle':
|
||||
$value = (int) $value;
|
||||
break;
|
||||
}
|
||||
|
||||
parent::set_option($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$type = $origine->get_phrasea_type();
|
||||
|
||||
if ($type !== 'image')
|
||||
throw new Exception('Cant rotate non image files');
|
||||
|
||||
$fichier = $origine->getPathname();
|
||||
$source = imagecreatefromjpeg($fichier);
|
||||
$rot = $this->options['angle'] * -1;
|
||||
$source = imagerotate($source, $rot, 0);
|
||||
imagejpeg($source, $dest, 90);
|
||||
imagedestroy($source);
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
103
lib/classes/binaryAdapter/image/rotate/imagemagick.class.php
Normal file
103
lib/classes/binaryAdapter/image/rotate/imagemagick.class.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ImageMagick image resize processor for binaryAdapter package
|
||||
*
|
||||
* @package binaryAdapter
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class binaryAdapter_image_rotate_imagemagick extends binaryAdapter_processorAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array(
|
||||
'angle' => 90
|
||||
);
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binary_name = 'GV_imagick';
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @return binaryAdapter_image_resize_imagemagick
|
||||
*/
|
||||
protected function set_option($name, $value)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'angle':
|
||||
$value = (int) $value;
|
||||
break;
|
||||
}
|
||||
|
||||
parent::set_option($name, $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param system_file $origine
|
||||
* @param string $dest
|
||||
* @return system_file
|
||||
*/
|
||||
protected function process(system_file $origine, $dest)
|
||||
{
|
||||
$type = $origine->get_phrasea_type();
|
||||
|
||||
if ($type !== 'image')
|
||||
throw new Exception('Cant rotate non image files');
|
||||
|
||||
$cmd = $this->binary;
|
||||
|
||||
$cmd .= ' -rotate ' . $this->options['angle'];
|
||||
|
||||
$array = array(
|
||||
'image/tiff',
|
||||
'application/pdf',
|
||||
'image/psd',
|
||||
'image/vnd.adobe.photoshop',
|
||||
'image/photoshop',
|
||||
'image/ai',
|
||||
'image/illustrator',
|
||||
'image/vnd.adobe.illustrator'
|
||||
);
|
||||
|
||||
if (in_array($origine->get_mime(), $array))
|
||||
{
|
||||
$cmd .= sprintf(' %s %s'
|
||||
, $this->escapeshellargs($origine->getPathname(), '[0]')
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd .= sprintf(' %s %s'
|
||||
, $this->escapeshellargs($origine->getPathname())
|
||||
, $this->escapeshellargs($dest)
|
||||
);
|
||||
}
|
||||
|
||||
$this->shell_cmd($cmd);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user