Created
July 15, 2010 03:19
-
-
Save ThePixelDeveloper/476453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct access allowed.'); | |
/** | |
* @package Kohana/Codebench | |
* @category Tests | |
* @author Mathew Davies <[email protected]> | |
*/ | |
class Bench_Resize extends Codebench | |
{ | |
public $description = 'Find out the fastest possible way to create an image thumbnail.'; | |
public $loops = 10; | |
public $subjects = array | |
( | |
'data/wicked-twister.jpg', | |
); | |
public function bench_kohana($subject) | |
{ | |
$image = Image::factory(APPPATH.$subject); | |
$image->resize(280, 210, Image::NONE); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_point($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_POINT, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_box($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_BOX, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_triangle($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_TRIANGLE, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_hermite($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_HERMITE, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_hanning($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_HANNING, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_hamming($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_HAMMING, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_blackman($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_BLACKMAN, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_gaussian($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_GAUSSIAN, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_quadratic($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_QUADRATIC, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_cubic($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_CUBIC, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_catrom($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_CATROM, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_mitchell($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_MITCHELL, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_lanczos($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_LANCZOS, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_bessel($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_BESSEL, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
public function bench_sinc($subject) | |
{ | |
$image = new Imagick(APPPATH.$subject); | |
$image->resizeImage(280, 210, Imagick::FILTER_SINC, 1); | |
return '<img src=data:image/png;base64,'.base64_encode($image).' />'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment