20150122--Merchandise Storage + thumbnails + access rights-02

Source: Internet
Author: User

Package Picture Tool Class

1. In the foreground of the public files inside the production tool class: Image. /includes/image.class.php

2. Add attributes

3. Initialization properties: The user can customize or use the system default.

A) size of the configuration thumbnail in the configuration file

b) Construction method initialization Property

4. Increase the thumbnail image making method.

A) determine if the source file exists

b) Determine which function is called to open the original resource by using the file's suffix name.

c) Open resources through variable functions

d) Get thumbnail resources

e) Compress pictures

The principle of the actual occupation width and height of the thumbnail image

Get an array of pictures: Width and height

GetImageSize: An array of the resulting

f) Image Sample copy

g) Save thumbnail image

Thumbnail filler: Sometimes thumbnails are not fully filled with the specified canvas, you need to move the thumbnail to the middle of the canvas, so that the picture appears stacked, and the thumbnail background is black by default, you need to fill the background color with the background hue of the picture near (usually white)

h) Filler: To center the thumbnail view

I. The background color needs to be filled with white

II. Find out the corresponding position

5. Call the picture class to make a thumbnail image. /admin/goods.php?act=insert

Display thumbnails on the Product List screen

Add a column of data directly to the template. /admin/templates/goods_list.html

Front desk and front end

Front End: Html+css+js (static pages are front-end tasks)

Backend: Php+mysql (PHP Programmer's Thing)

Front Desk: User-visited sections

Background: Administrator maintains partial access restrictions

Some files or folders that you do not want users to access directly, to restrict user access.

Control:<directory> Control access via Apache

Effect

Mvc

1. What is MVC?

MVC is a kind of design idea, which separates the display of data, business logic and data logic, so that the specific documents do the specific things and do not interfere with each other.

M:model, model, specifically responsible for manipulating databases for data processing

V:view, view, specifically responsible for displaying data (HTML)

C:controller, controller, specifically responsible for business logic processing, is also the user can only request the script

Script code History

1. Mixed mode: Embed PHP code in HTML

Benefits: Highest Execution efficiency

Cons: not conducive to maintenance

2. Template technology: Separating the PHP code from the HTML code

Advantages: Clear front and rear end points for easy maintenance

Cons: Manipulating data is mixed with business logic and is not conducive to code expansion

3. MVC idea: Separate display (HTML), business logic and data processing logic

Advantages: Code structure is very clear, more conducive to maintenance, more conducive to code reuse

Cons: Increases the execution time of the code

The shop project is designed exactly according to the idea of MVC.

Key words

Controllers: Controller, also become modules (module)

Models: Model

Views: view, templates (Templates)

20150122--Merchandise Storage + thumbnails + access rights-02

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.