How can a website store images uploaded by users?

Source: Internet
Author: User
For example, if a product image is uploaded to an original image and different sizes need to be displayed in different parts of the website, such as the list page, details page, and mobile phone version, how can we do this, is multiple copies saved during the first upload? You do not need to retain the original image of the user. We found that there is another way to do this...

For example, if a product image is uploaded to an original image and different sizes need to be displayed in different parts of the website, such as the list page, details page, and mobile phone version, how can we do this, is multiple copies saved during the first upload? Do you need to retain the original image of the user? I found that there is another way to do this: ELE. Me,

The following parameters can be adjusted at will to output images of different sizes. It is estimated that the source image is saved, right?

Reply content:

For example, if a product image is uploaded to an original image and different sizes need to be displayed in different parts of the website, such as the list page, details page, and mobile phone version, how can we do this, is multiple copies saved during the first upload? Do you need to retain the original image of the user? I found that there is another way to do this: ELE. Me,

The following parameters can be adjusted at will to output images of different sizes. It is estimated that the source image is saved, right?

For small teams, it is of course good to use cloud storage like qiniu or youpai cloud. It comes with cnd and can use APIs for image processing.
If you have your own server, you will consume more traffic and computing resources. If you do not have anything on your server, you can still store it in qiniu or cloud.

Another way is to convert the image into a base64 database. This step can be done at the front end. Of course, it is also a disadvantage, that is, the cache is not convenient, but it is not acceptable if there are a few images, it is much more convenient than 7 cows.

My common method is to mirror to a service provider such as qiniu cloud storage L. Because they can generate thumbnails flexibly, and also have built-in cdn

Each person may have different processing methods. My processing method is: For uploaded images, create a separate folder to save. Of course, you can create a directory under this file directory based on the year and month. Ueditor uses this method for uploaded images. For the image name, can be simply processed after the random string name, such as the list page image: http://blog.92fenxiang.com/category/showcat/%E5%89%8D%E7% AB %AF%E5%BC%80%E5%8F%91

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.