用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3090|回复: 1
收起左侧

[版本 2.x] timthumb在CI中的运用

[复制链接]
发表于 2012-3-29 17:21:19 | 显示全部楼层 |阅读模式
因为裁减缩略图的需要,我这边在网上下载了timthumb,在单纯的PHP中可以运用
然我现在想把他在CI中用控制器来进行访问,不知道具体该怎么用
我用以下方法
define ('FILE_CACHE_DIRECTORY', '/uploadfile/cache');定义并有权限
class Thimhumb extends CI_Controller {
    function __construct()
    {
        parent::__construct();
    }
public function index()
{
  $this->load->helper(array('thimhumb')); //thimhumb放在helpers 里thimhumb_helper.php //
}
}
然后在视图文件里,试图通过
<img src="<?php echo site_url('/thimhumb/').'?src=/uploadfile/201203/12/2012031243632697407073.jpg&w=100&h=200&zc=1&q=80';?>" alt='Logo'/>

但是结果不能显示图片,希望知道这个应用的给以帮助,谢了


 楼主| 发表于 2012-3-29 17:41:23 | 显示全部楼层
可以了,原来是我不小心在thimhumb_helper.php 加了一行输出代码的原因

本版积分规则