kinglike 发表于 2010-9-8 17:57:48

关于循环处理缩略图的问题

关于循环处理缩略图的问题
一下是代码:


   for($i=1;$i<$this->input->post('total');$i++)
   {
    $configThumb['image_library'] = $this->input->post('image_library');
    $configThumb['create_thumb'] = ''.$this->input->post('create_thumb').'';
    $configThumb['thumb_marker'] = $this->input->post('thumb_marker');
    $configThumb['width'] = $this->input->post('width');
    $configThumb['height'] = $this->input->post('height');
    $configThumb['source_image'] = $this->input->post('source_image').sprintf("%03d", $i).'.jpg';
    $configThumb['new_image'] = $this->input->post('new_image').sprintf("%03d", $i).'.jpg';
    $this->load->library('image_lib', $configThumb);
    if ( ! $this->image_lib->resize()){
   echo $this->image_lib->display_errors();
    }
    echo $configThumb['new_image'].'<br>';
    echo $configThumb['source_image'].'<br>';
    echo '<hr>';
   }



执行的意图是:
例如:提交后将该目录下20个图片:001.jpg --020.jpg
生成做略图:thumb_001.jpg -thumb_020.jpg

如果取掉循环可以正常。加上循环后只能生成第一个图片。后面的都不行。
请帮助?

kinglike 发表于 2010-9-8 18:13:18

检查了半天。!发现少了一句话
$this->image_lib->initialize($configThumb);
现在好了!哈哈哈!

kinglike 发表于 2010-9-8 20:57:31

又有问题了!我想能动态显示处理的进度?如何实现?现在总是全部执行完毕后才显示结果!

jeongee 发表于 2010-9-8 21:28:47

处理完一个输出一下完成了多少个不就行啦

kinglike 发表于 2010-9-8 21:40:18

我现在用的for循环,输出的结果是循环完毕后输出的总结果。我想要处理1个完毕给个提示。

jeongee 发表于 2010-9-8 22:24:46

本帖最后由 ywqbestever 于 2010-9-8 22:26 编辑

for循环体执行完一次不就说明完成了一个吗?
那你for循环的最后加个统计不就知道完成了的数目吗?(这个数目在你的程序里和i的值相等)
按照 已完成的数目/总数 的形式输出,不就是进度了吗?
我说的不清楚吗?

Hex 发表于 2010-9-9 01:22:22

显示进度一般用 ajax 好一些。

sonic 发表于 2010-9-9 06:23:44

jQuery插件官网维护这几天。
页: [1]
查看完整版本: 关于循环处理缩略图的问题