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 "/}