PHP 开发:CodeIgniter 图像处理类
本文主要为大家分析介绍 CodeIgniter 的图像处理类,感兴趣的朋友参考下
image.php
代码如下:
<?php
class
Image
extends
Controller {
function
Image()
{
parent::Controller();
$this
->load->library('image_lib');
}
//缩略图
function
index(){
echo
'*
调整图像大小 <br>
*
创建缩略图 <br>
*
图像裁剪 <br>
*
图像旋转 <br>
*
添加图像水印 <br>
';
}
//缩略图
function
resize(){
/*
注意
当$config['create_thumb']等于 FALSE 并且$config['new_image']没有指定时,会调整原图的
大小
当$config['create_thumb']等于 TRUE 并且$config['new_image']没有指定时,生成文件名为
(
原图名 _thumb.扩展名)
当$config['create_thumb']等于 FALSE 并且$config['new_image']指定时,生成文件名为
$config['new_image']的值
当$config['create_thumb']等于 TRUE 并且$config['new_image']指定时,生成文件名为(原图
名 _thumb.扩展名)
*/
$config
['image_library'] = 'gd2';
//(必须)设置图像库