THINKPHP3.2.3 implement background custom Image Upload Configuration

Source: Internet
Author: User
Tags add time
Bytes

THINKPHP3.2.3 implement custom Image Upload formats and sizes in the background; add watermark conditions (watermark can be added only when the width is greater than the height), watermark type (text and image), watermark text color and size, watermark image upload, watermark position and transparency configuration demo address please visit http://www.gouguoyin.cn/php/32.html

THINKPHP3.2.3 implement custom Image Upload formats and sizes in the background; add watermark conditions (watermark can be added only when the width is greater than the height), watermark type (text and image), watermark text color and size, watermark image upload, watermark position and transparency Configuration
Demo address please visit http://www.gouguoyin.cn/php/32.html
ThinkPHP
Tutorial 1: CREATE a website configuration TABLE on the database homepage. The fields are described as follows: create table if not exists 'go _ config' ('id' int (10) not null AUTO_INCREMENT, 'field' varchar (255) not null comment 'attribute field', 'title' varchar (255) not null comment' field title ', 'mark' varchar (255) not null comment' remarks, mainly used for displaying ', 'field _ type' varchar (255) not null default 'string' comment' field type, string: string longstring: long string phone: Mobile phone Number email: email url: link address bool: Boolean text: Multi-Line text editor: editor pic: Image file: file, default string ', 'config _ type' varchar (255) not null default 'site 'comment' configuration type', 'value' varchar (255) not null comment' field value ', 'Is _ system' tinyint (1) not null default '0' comment' is a system field, 0: No 1: Yes, the system field cannot be deleted ', 'Is _ required' tinyint (1) not null default '0' comment' is required, 1: required: 0: NOT required, DEFAULT: 0 ', 'sort 'int (10) not null default '1' comment' sort', 'status' tinyint (1) not null default '1' comment' status, 1: normal, 0: Recycle Bin. Default Value: 1', 'add _ time' datetime not null comment 'add time ', 'Update _ time' timestamp not null default CURRENT_TIMESTAMP ON update CURRENT_TIMESTAMP COMMENT 'Update time', primary key ('id'), unique key 'field' ('field ')) ENGINE = InnoDB default charset = utf8 COMMENT = 'System configuration table' AUTO_INCREMENT = 1; 2. The Controller creates ConfigController under the application/Admin/Controller/directory of the project. class. php controller, the Code is as follows
 Display ('config _ upload');} // Save the upload configuration public function upload_save () {$ data = I ('Post. '); foreach ($ data as $ k => $ v) {$ result = M ('config')-> where (array ('field' => $ k )) -> save (array ('value' = >$ v);} $ this-> success ('upload settings saved successfully ', U ('admin/Config/upload');} 3. Create a config_upload.html Template under the application/Admin/View/configdirectory of the project, the Code is as follows: {include file = "Public/header" title = "Upload Settings"/} {include file = "Public/sidebar "/}
 
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.