zoukankan      html  css  js  c++  java
  • 后盾网-CI框架实例教程-马振宇

    第九节视频:CI框架学习-实例操作发表文章之CI框架文件上传类缩略图类使用

     一、文件上传类的使用:

      在application ->controllers ->admin ->article.php

       1、配置

        $config["upload_path"] = "./uploads/";

        $config["allowed_type"] = "gif | jpg | png | jpeg";

        $config["max_size"] = "10000";

        $config["max_width"] = "1024";

        $config["max_height"] = "768";

        $config["file_name"] = time() . mt_rand(1000,9999);

       2、载入上传类

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

       3、执行上传动作

        $status = $this ->upload ->do_upload("thumb");

       4、验证上传是否成功

         $wrong = $this ->upload ->display_errors();

          if($wrong){

          error($wrong);

            }

         5、返回信息

         $info = $this ->upload ->data();

           二、缩略图类(图像处理类)的使用:

        1、配置

         $arr["source_image"] = $info["full_path"];

            $arr["create_thumb"] = FALSE;

         $arr["maintain_ratio"] = TRUE;

            $arr["width"] = 200;

            $arr["height"] = 200;

        2、载入缩略图类

         $this ->load ->library("image_lib",$arr);

        3、执行动作

         $status = $this ->image_lib ->resize();

        4、验证缩略是否成功

          if(!$status){

            error("缩略图动作失败");

          }

  • 相关阅读:
    hbase安装(zookeeper等)
    虚函数表以及RTTI阅读(阅后焚)
    void及void指针含义的深刻解析
    泛型和模版的区别
    C++析构函数为什么要为虚函数
    C++对象模型
    在C++中子类继承和调用父类的构造函数方法
    什么是复合类型
    C++ read
    gdb 调试c/c++的一些小技巧
  • 原文地址:https://www.cnblogs.com/chengshun/p/7637099.html
Copyright © 2011-2022 走看看