Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (20 sloc) 608 Bytes
<?php
class Thumbnailer extends CApplicationComponent
{
public $wideImagePath; // WideImage relative path from application base path
public $width;
public $height;
public function init()
{
include Yii::app()->basePath.DIRECTORY_SEPARATOR.
$this->wideImagePath.DIRECTORY_SEPARATOR.
'WideImage.php';
}
public function generate($imagePath, $thumbnailPath)
{
$image = WideImage::load($imagePath);
$resized = $image->resize($this->width, $this->height, 'outside');
$cropped = $resized->crop('center', 'center', $this->width, $this->height);
$cropped->saveToFile($thumbnailPath);
}
}
Something went wrong with that request. Please try again.