zoukankan      html  css  js  c++  java
  • 上传类、图片处理类

    上传类
    1.上传类的配置项

    $config['upload_path'] = '文件上传的位置';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '100';//单位为kb ,php.ini 限制为 2M
    $config['encrypt_name'] = 'true';//文件名随机
    $config['max_width'] = '1024';//针对图片类型宽度限制 
    $config['max_height'] = '768';//针对图片类型高度限制

    2.加载上传类

    $this->load->library('upload',$config);

    3.判断是否上传成功

    $this->upload->do_upload('fileName');//文件域中表单 name

    4.获取上传后的数组

    $this->upload->data();

    5.获取上传失败的信息

    $this->upload->display_errors();

    6.上传类使用技巧
    当多文件上传时遍历

    $this->upload->initialize($config);//初始化
    $this->upload->do_upload('fileName');//判断成功保存full_path

    图片类
    1.配置项

    $config['source_image'] = $data['full_path'] ; //图片类和上传类关联

    2.加载类文件

    $this->load->library('image_lib');

    3.初始化

    $this->image_lib->initialize($config);

    4.生成图片

    $this->image_lib->resize();
  • 相关阅读:
    IO模型
    Redis的cluster模式
    #4789. 啊孤独感放辣椒
    #4754. 旅途
    #3189. 八纵八横(c)
    洛谷P2624 [HNOI2008]明明的烦恼
    CF938G Shortest Path Queries
    [CTSC2010]珠宝商
    洛谷P1903 [国家集训队]数颜色 / 维护队列
    AtCoder3611 Tree MST
  • 原文地址:https://www.cnblogs.com/zc123/p/5403734.html
Copyright © 2011-2022 走看看