check out this little test
test
This is the normal speed of execution, or are slow?
code
Code: Select all
<?php
$DOCROOT = realpath(dirname(__FILE__)).'/';
$filein = $DOCROOT.'useruploads/userphotos/tmp/'.'dolphins.jpg';
$fileout = $DOCROOT.'output/'. uniqid().'.jpg';
// Command 1
$command = '/usr/bin/convert '.escapeshellarg($filein);
$command .= ' -resize 270x265^ '.escapeshellarg($fileout);
$time_start = microtime(TRUE);
exec($command);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo 'time: '.$time.'s';
?>
<br /><hr />
<?php
$file_effect = $DOCROOT.'images/effects/4e0c68cbc989311-ru-d23d5c41f769579346eddaf605cf9481.png';
$fileout = $DOCROOT.'output/'. uniqid().'.jpg';
// Command 2
$command = '/usr/bin/convert '.escapeshellarg($file_effect).' \( '.escapeshellarg($filein).' -resize 270x265^ -gravity center -extent 270x265 -level -10% -gravity NorthWest -matte -virtual-pixel transparent -distort Perspective "0,0,1,1 0,265,0,264 265,0,260,72 265,260,268,236" \) -background none -geometry +177+186 -compose Atop -composite '.escapeshellarg($fileout);
$time_start = microtime(TRUE);
exec($command);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo 'time: '.$time.'s';
?>
- Server ubuntu-x86_64 500 Mhz RAM 256 Mb
PHP Version 5.3.3-1ubuntu9.5
ImageMagick 6.6.2-6 2010-12-02 Q16