Yii 1.1: cthumb

缩略图生成
1 follower

网上找来的一个生成缩略图的函数

Resources

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions
  • extension=php_gd2.dll

Usage

See the following code example:

...             
$im = null;
$imagetype = strtolower($model->image->extensionName)
if($imagetype == 'gif')
    $im = imagecreatefromgif($path);
else if ($imagetype == 'jpg')
    $im = imagecreatefromjpeg($path);
else if ($imagetype == 'png')
    $im = imagecreatefrompng($path);
CThumb::resizeImage ( 
$im,100, 100,
'd:\upload\head\\thumb\\test' . $model->image->extensionName, $model->image->extensionName );
...

Change Log

December 17, 2009

  • Initial release.

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads