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("缩略图动作失败");

          }

  • 相关阅读:
    v4l2程序实例
    uboot的readme导读
    基于Linux的v4l2视频架构驱动编写
    V4L2
    Uboot优美代码赏析1:目录结构和malkefile分析
    查找 mysql 配置文件 my.cnf
    thinkphp中array_diff运行无效 Invalid opcode 153/1/8
    thinkphp后端开发ajax接口开发测试
    Thinkphp getLastSql函数用法
    web日志分析的重要性
  • 原文地址:https://www.cnblogs.com/chengshun/p/7637099.html
Copyright © 2011-2022 走看看