国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Usage analysis of CI framework file upload class and image processing class, ci file upload
Home Backend Development PHP Tutorial Usage analysis of CI framework file upload class and image processing class, ci file upload_PHP tutorial

Usage analysis of CI framework file upload class and image processing class, ci file upload_PHP tutorial

Jul 12, 2016 am 08:52 AM
ci framework Image Processing File Upload

Usage analysis of CI framework file upload class and image processing class, ci file upload

This article describes the usage of CI framework file upload class and image processing class with examples. Share it with everyone for your reference, the details are as follows:

//列表頁banner圖片
public function edit_list_page_banner($category_id=""){
  $category_id= empty($category_id)?$_POST["category_id"]:$category_id;
  //上傳圖片
  if(isset($_POST["key"]) && $_POST["key"] == "upload"){
   /*
   1.set_upload_path
   */
   $config['upload_path']="./upload/source/".date("Y/m/d");//文件上傳目錄
   if(!file_exists("./upload/source/".date("Y/m/d"))){
    mkdir("./upload/source/".date("Y/m/d"),0777,true);//原圖路徑
   }
   if(!file_exists("./upload/big_thumb/".date("Y/m/d"))){
    mkdir("./upload/big_thumb/".date("Y/m/d"),0777,true);//大縮略圖路徑
   }
   if(!file_exists("./upload/small_thumb/".date("Y/m/d"))){
    mkdir("./upload/small_thumb/".date("Y/m/d"),0777,true);//小縮略圖路徑
   }
   $config['allowed_types']="gif|jpg|png|txt";//文件類型
   $config['max_size']="20000";//最大上傳大小
   $this->load->library("upload",$config);
   if($this->upload->do_upload('userfile'))//表單中name="userfile"
   {
    //上傳成功之后,生成兩張縮略圖
    $data=$this->upload->data();//返回上傳圖片的信息
    $this->load->library("image_lib");//載入圖像處理類庫
    //第一種方式:大縮略圖的配置參數(shù)
    /*
    $config_big_thumb['image_library'] = 'gd2';//gd2圖庫
    $config_big_thumb['source_image'] = $data['full_path'];//原圖
    $config_big_thumb['new_image'] = "./upload/big_thumb/".date("Y/m/d")."/".$data['file_name'];//大縮略圖
    $config_big_thumb['create_thumb'] = true;//是否創(chuàng)建縮略圖
    $config_big_thumb['maintain_ratio'] = true;
    $config_big_thumb['width'] = 300;//縮略圖寬度
    $config_big_thumb['height'] = 300;//縮略圖的高度
    $config_big_thumb['thumb_marker']="_300_300";//縮略圖名字后加上 "_300_300",可以代表是一個300*300的縮略圖
    */
    //第二種:大縮略圖的配置參數(shù)
    /*
    $config_big_thumb=array(
     'image_library' => 'gd2',//gd2圖庫
     'source_image' => $data['full_path'],//原圖
     'new_image' => "./upload/big_thumb/".date("Y/m/d")."/".$data['file_name'],//大縮略圖
     'create_thumb' => true,//是否創(chuàng)建縮略圖
     'maintain_ratio' => true,
     'width' => 300,//縮略圖寬度
     'height' => 300,//縮略圖的高度
     'thumb_marker'=>"_300_300"//縮略圖名字后加上 "_300_300",可以代表是一個300*300的縮略圖
    );
    */
    //第三種方式:將部分配置信息放到了config.php文件中
    $config_big_thumb=$this->config->item("config_big_thumb");
    $config_big_thumb['source_image']=$data['full_path'];
    $config_big_thumb['new_image']="./upload/big_thumb/".date("Y/m/d")."/".$data['file_name'];
    //小縮略圖的配置參數(shù)
    /*
    $config_small_thumb['image_library'] = 'gd2';//gd2圖庫
    $config_small_thumb['source_image'] = $data['full_path'];//原圖
    $config_small_thumb['new_image'] = "./upload/small_thumb/".date("Y/m/d")."/".$data['file_name'];//大縮略圖
    $config_small_thumb['create_thumb'] = true;//是否創(chuàng)建縮略圖
    $config_small_thumb['maintain_ratio'] = true;
    $config_small_thumb['width'] = 100;//縮略圖寬度
    $config_small_thumb['height'] = 100;//縮略圖的高度
    $config_small_thumb['thumb_marker']="_100_100";//縮略圖名字后加上 "_100_100",可以代表是一個100*100的縮略圖
    */
    //小縮略圖的配置參數(shù)
    $config_small_thumb=array(
     'image_library' => 'gd2',//gd2圖庫
     'source_image' => $data['full_path'],//原圖
     'new_image' => "./upload/small_thumb/".date("Y/m/d")."/".$data['file_name'],//大縮略圖
     'create_thumb' => true,//是否創(chuàng)建縮略圖
     'maintain_ratio' => true,
     'width' => 100,//縮略圖寬度
     'height' => 100,//縮略圖的高度
     'thumb_marker'=>"_100_100"//縮略圖名字后加上 "_300_300",可以代表是一個300*300的縮略圖
    );
    //$this->load->library("image_lib",$config_thumb);
    $this->image_lib->initialize($config_big_thumb);
    $this->image_lib->resize();//生成big縮略圖
    $this->image_lib->initialize($config_small_thumb);
    $this->image_lib->resize();//生成small縮略圖
    //插入數(shù)據(jù)庫
    $data_array = array(
     'category_id' => $category_id,
     'pic_url' => "./upload/source/".date("Y/m/d")."/".$data['file_name'],
     'addtime' => time(),
     'is_stop' => 1,
     'sort'=>0,
     'gender' => $_POST["gender"],
     'link_url'=>$_POST["link_url"],
     'user_id' => intval($this->cur_user ['user_id'])
    );
    $this->category_model->add_category_banner($data_array);
   }
  }
  $con_arr[] = " category_id= '{$category_id}'";
  if ($gender=='' ) {
   $gender=0;
  }
  $con_arr[] = " gender= '{$gender}'";
  $condition = implode( ' and ', $con_arr);
  $banner_list = $this->category_model->get_banner_all($condition);
  $this->tp->assign('banner_list', $banner_list);
  $this->tp->assign('base_url', base_url());
  $this->tp->assign('gender', $gender);
  $this->tp->assign('category_id', $category_id);
  $this->tp->display("category/edit_list_page_banner.php");
}

Configuration items related to thumbnails in the config.php file:

//大縮略圖的配置參數(shù)
$config_big_thumb=array(
 'image_library' => 'gd2',//gd2圖庫
 'create_thumb' => true,//是否創(chuàng)建縮略圖
 'maintain_ratio' => true,
 'width' => 300,//縮略圖寬度
 'height' => 300,//縮略圖的高度
 'thumb_marker'=>"_300_300"//縮略圖名字后加上 "_300_300",可以代表是一個300*300的縮略圖
);

Readers who are interested in more CodeIgniter related content can check out the special topics of this site: "codeigniter introductory tutorial", "CI (CodeIgniter) framework advanced tutorial", "php excellent development framework summary", "ThinkPHP introductory tutorial", "Summary of Common Methods in ThinkPHP", "Introduction Tutorial on Zend FrameWork Framework", "Introduction Tutorial on PHP Object-Oriented Programming", "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone’s PHP program design based on the CodeIgniter framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1127857.htmlTechArticleCI framework file upload class and image processing class usage analysis, ci file upload This article describes the CI framework file upload class with examples and image processing usage. Share it with everyone for your reference, specifically...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Implement file upload and download in Workerman documents Implement file upload and download in Workerman documents Nov 08, 2023 pm 06:02 PM

To implement file upload and download in Workerman documents, specific code examples are required. Introduction: Workerman is a high-performance PHP asynchronous network communication framework that is simple, efficient, and easy to use. In actual development, file uploading and downloading are common functional requirements. This article will introduce how to use the Workerman framework to implement file uploading and downloading, and give specific code examples. 1. File upload: File upload refers to the operation of transferring files on the local computer to the server. The following is used

How is Wasserstein distance used in image processing tasks? How is Wasserstein distance used in image processing tasks? Jan 23, 2024 am 10:39 AM

Wasserstein distance, also known as EarthMover's Distance (EMD), is a metric used to measure the difference between two probability distributions. Compared with traditional KL divergence or JS divergence, Wasserstein distance takes into account the structural information between distributions and therefore exhibits better performance in many image processing tasks. By calculating the minimum transportation cost between two distributions, Wasserstein distance is able to measure the minimum amount of work required to transform one distribution into another. This metric is able to capture the geometric differences between distributions, thereby playing an important role in tasks such as image generation and style transfer. Therefore, the Wasserstein distance becomes the concept

Application of AI technology in image super-resolution reconstruction Application of AI technology in image super-resolution reconstruction Jan 23, 2024 am 08:06 AM

Super-resolution image reconstruction is the process of generating high-resolution images from low-resolution images using deep learning techniques, such as convolutional neural networks (CNN) and generative adversarial networks (GAN). The goal of this method is to improve the quality and detail of images by converting low-resolution images into high-resolution images. This technology has wide applications in many fields, such as medical imaging, surveillance cameras, satellite images, etc. Through super-resolution image reconstruction, we can obtain clearer and more detailed images, which helps to more accurately analyze and identify targets and features in images. Reconstruction methods Super-resolution image reconstruction methods can generally be divided into two categories: interpolation-based methods and deep learning-based methods. 1) Interpolation-based method Super-resolution image reconstruction based on interpolation

In-depth analysis of the working principles and characteristics of the Vision Transformer (VIT) model In-depth analysis of the working principles and characteristics of the Vision Transformer (VIT) model Jan 23, 2024 am 08:30 AM

VisionTransformer (VIT) is a Transformer-based image classification model proposed by Google. Different from traditional CNN models, VIT represents images as sequences and learns the image structure by predicting the class label of the image. To achieve this, VIT divides the input image into multiple patches and concatenates the pixels in each patch through channels and then performs linear projection to achieve the desired input dimensions. Finally, each patch is flattened into a single vector, forming the input sequence. Through Transformer's self-attention mechanism, VIT is able to capture the relationship between different patches and perform effective feature extraction and classification prediction. This serialized image representation is

Scale Invariant Features (SIFT) algorithm Scale Invariant Features (SIFT) algorithm Jan 22, 2024 pm 05:09 PM

The Scale Invariant Feature Transform (SIFT) algorithm is a feature extraction algorithm used in the fields of image processing and computer vision. This algorithm was proposed in 1999 to improve object recognition and matching performance in computer vision systems. The SIFT algorithm is robust and accurate and is widely used in image recognition, three-dimensional reconstruction, target detection, video tracking and other fields. It achieves scale invariance by detecting key points in multiple scale spaces and extracting local feature descriptors around the key points. The main steps of the SIFT algorithm include scale space construction, key point detection, key point positioning, direction assignment and feature descriptor generation. Through these steps, the SIFT algorithm can extract robust and unique features, thereby achieving efficient image processing.

How to use AI technology to restore old photos (with examples and code analysis) How to use AI technology to restore old photos (with examples and code analysis) Jan 24, 2024 pm 09:57 PM

Old photo restoration is a method of using artificial intelligence technology to repair, enhance and improve old photos. Using computer vision and machine learning algorithms, the technology can automatically identify and repair damage and flaws in old photos, making them look clearer, more natural and more realistic. The technical principles of old photo restoration mainly include the following aspects: 1. Image denoising and enhancement. When restoring old photos, they need to be denoised and enhanced first. Image processing algorithms and filters, such as mean filtering, Gaussian filtering, bilateral filtering, etc., can be used to solve noise and color spots problems, thereby improving the quality of photos. 2. Image restoration and repair In old photos, there may be some defects and damage, such as scratches, cracks, fading, etc. These problems can be solved by image restoration and repair algorithms

Simplify file upload processing with Golang functions Simplify file upload processing with Golang functions May 02, 2024 pm 06:45 PM

Answer: Yes, Golang provides functions that simplify file upload processing. Details: The MultipartFile type provides access to file metadata and content. The FormFile function gets a specific file from the form request. The ParseForm and ParseMultipartForm functions are used to parse form data and multipart form data. Using these functions simplifies the file processing process and allows developers to focus on business logic.

How to use gRPC to implement file upload in Golang? How to use gRPC to implement file upload in Golang? Jun 03, 2024 pm 04:54 PM

How to implement file upload using gRPC? Create supporting service definitions, including request and response messages. On the client, the file to be uploaded is opened and split into chunks, then streamed to the server via a gRPC stream. On the server side, file chunks are received and stored into a file. The server sends a response after the file upload is completed to indicate whether the upload was successful.

See all articles