Skip to content

Instantly share code, notes, and snippets.

@cocoiti
Created November 6, 2012 04:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocoiti/4022657 to your computer and use it in GitHub Desktop.
Save cocoiti/4022657 to your computer and use it in GitHub Desktop.
# http://www.php.net/manual/ja/imagick.setsize.php
<?php
require_once 'Benchmark/Timer.php';
$file = __DIR__ . '/sample.jpg';
$sizeX = 160;
$sizeY = 160;
$t = new Benchmark_Timer();
$t->start();
$imagickInit = new imagick();
$imagickInit->readImage($file);
$t->setMarker('init');
$imagick = new imagick();
$imagick->readImage($file);
$imagick->setSize($sizeX, $sizeY);
$t->setMarker('nomal');
$imagick2 = new imagick();
$imagick2->setSize($sizeX, $sizeY);
$imagick2->readImage($file);
$t->setMarker('size');
$t->stop();
$t->display();
/*
------
output
------
----------------------------------------------------
marker time index ex time perct
----------------------------------------------------
Start 1352177660.18864500 - 0.00%
----------------------------------------------------
init 1352177660.34335900 0.15471410751343 45.23%
----------------------------------------------------
nomal 1352177660.50730700 0.16394805908203 47.93%
----------------------------------------------------
size 1352177660.53063100 0.023324012756348 6.82%
----------------------------------------------------
Stop 1352177660.53067500 4.3869018554688E-5 0.01%
----------------------------------------------------
total - 0.34203004837036100.00%
----------------------------------------------------
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment