Skip to content

Instantly share code, notes, and snippets.

@DrMabuse23
Created December 5, 2011 14:55
Show Gist options
  • Save DrMabuse23/1433852 to your computer and use it in GitHub Desktop.
Save DrMabuse23/1433852 to your computer and use it in GitHub Desktop.
config/main.php
'image'=>array(
'class'=>'application.extensions.image.CImageComponent',
// GD or ImageMagick
'driver'=>'GD',
// ImageMagick setup path
// 'params'=>array('directory'=>'/opt/local/bin'),
'params'=>array('directory'=>'/Applications/MAMP/Library'),
),
in Model :
$_path = 'images/uploads/media/org/'.$model->image->name;
$image = Yii::app()->image->load($_path);
if($style->crop == 1){
$image->crop($style->crop_width,$style->crop_height);
}
if($style->quality == 1){
$image->quality($style->quality_range);
}
if($style->sharpen == 1){
$image->sharpen($style->sharpen_range);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment