20150122--Merchandise Storage + thumbnail + access rights

Source: Internet
Author: User

New Products

Then the day before yesterday to do the goods added continue, the day before yesterday to finish the legitimacy of the product verification.

1. Validation of the validity of the commodity data. Verify that the item number is unique or should be generated automatically when the user does not manually fill in the item number. /admin/goods.php?act=insert

2. Create a method to validate the item number. /admin/includes/goods.class.php

3. Judge the result of the verification and do the operation according to the result. /admin/goods.php?act=insert

4. Create a method that automatically generates the item number. /admin/includes/goods.class.php

5. Store the generated item number in the user's new data. /admin/goods.php?act=insert

6. Invoke the method of the class to insert the data into the operation. /admin/goods.php?act=insert

7. Create a method to insert the database. /admin/includes/goods.class.php

8. Judge the result of the execution. /admin/goods.php?act=insert

File Upload

There are many places to apply to file uploads, which should be a separate tool class for uploading files.

1. Create a file upload class in the foreground public location. /includes/upload.class.php

2. Add a single file upload method.

3. Determine if the file to be uploaded is meaningful.

4. File upload error handling.

5. File Upload type control: Only upload images are allowed.

A) Specify the types of files that are allowed to be uploaded in the configuration file.

b) Determine whether the type of file satisfies the condition

6. Specify the size of the file: Configure it in the configuration file

A) specify the maximum allowable upload limit for the current file in the configuration file

b) Determine file size

7. Move the file to the specified directory.

A) renaming the file

b) Call the Generate file name method to generate a new file name and move the file.

8. When the product is inserted, call the file upload class to implement the file upload. /admin/goods.php?act=insert

9. Failure gives the appropriate error prompt.

Thumbnail images

Thumbnail: Compress (length and width, pixel size) on the base of the original image.

Application of thumbnail image

1. General site users see the first picture, are thumbnails

2. Thumbnail image because it is smaller than the original, so load faster, can reduce the use of bandwidth, can reduce the user's waiting time

The server compresses the thumbnails according to the original image. Make thumbnail images

Thumbnail production process

Make specific steps

1. Read the original source

Imagecreatefromgif/png/jpeg: Get a source of the original image

2. Create a thumbnail resource: container

Imagecreatetruecolor

3. Compress: Put the original resources into the thumbnail resources, and compress according to the proportion

imagecopyresampled: Sample copy, sample from one resource, copy to another resource summary

BOOL Imagecopyresampled (thumbnail resource, original source, thumbnail start x, thumbnail start y, original X, original image start Y, thumbnail width, thumbnail height, original width, original height)

4. Save the output: Save the thumbnail image

Imagepng:

5. Releasing resources: original and thumbnail images

20150122--Merchandise Storage + thumbnail + access rights

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.