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

          }

  • 相关阅读:
    MFC生成的exe程序不能在其他电脑上运行怎么办
    MFC开发软件支持多语言且同时支持xp和win7操作系统
    MFC创建模态对话框与非模态对话框
    如何定位BAD_ACCESS
    iOS中几种数据持久化方案
    iOS NSString相关问题
    SPU
    WIKI
    Mac怎么快速创建便签和发送附件的邮件
    利用你的Mission Control--设置快速回到桌面等操作
  • 原文地址:https://www.cnblogs.com/chengshun/p/7637099.html
Copyright © 2020-2023  润新知