How does the website go to record the uploaded image url appropriate?

Source: Internet
Author: User
For the site upload pictures, images are uploaded to the server, how can we record each uploaded image file storage address it?

For example: User uploaded images, albums, product pictures and so on, these uploaded pictures how can we record their location?

1: For example, the user table has a avatar field, the user uploads the picture, and then the shape such as: http://www.thinkphp.cn/Uploads/da/2015-08-05/55c18ef67e249.jpg Does such a picture URL be stored in the Avatar field? Or do you just save the image name, or split it into three domain names/paths/names and deposit three fields?

2: There are user albums, users upload a lot of pictures, this How to save the URL of the picture in the database?

3: There is also the DZ forum in a post content may contain a lot of pictures, how to save it, or to build a separate picture attachment table, and then associated with the post ID?

4: If you are using cloud storage, such as seven bull and pat the cloud, after using their interface upload, will you return a picture URL? So do we save the returned picture URL in the database like above?

Since the site has many places to use the image upload function, each uploaded image in the server location needs to be recorded, then we do not specifically create a table to save all the uploaded image URL?

I think of the simplest design of this table: Imgup (ID, URL)

So simple, all the uploaded picture information is recorded here, such as the original user table avatar saved is the image URL, now you can save the corresponding ID can be, so much simpler, product pictures, post content pictures, ..., all the same.

But I always feel that this is too simple, too inappropriate, the table in the end how to design the most reasonable? Need to add some other information, such as the original name before the client was uploaded, image size, image size, image creation time, picture modification time, pictures exif information, ... Wait a minute.

Have not seen the DZ code, the post can see each attachment picture and other files, and can control permissions for users to download, do not know how it is done.

This problem is extended to the site "file upload" above is not limited to the picture, all the uploaded file information is placed in this record upload file information table inside, it is more convenient, management is also convenient, so this question I think for a long time, is no experience, so first to ask you the big God.

Hope that the experience of the great God to enlighten, pointing maze, I do not have teeth unforgettable, thank you!

Reply content:

For the site upload pictures, images are uploaded to the server, how can we record each uploaded image file storage address it?

For example: User uploaded images, albums, product pictures and so on, these uploaded pictures how can we record their location?

1: For example, the user table has a avatar field, the user uploads the picture, and then the shape such as: http://www.thinkphp.cn/Uploads/da/2015-08-05/55c18ef67e249.jpg Does such a picture URL be stored in the Avatar field? Or do you just save the image name, or split it into three domain names/paths/names and deposit three fields?

2: There are user albums, users upload a lot of pictures, this How to save the URL of the picture in the database?

3: There is also the DZ forum in a post content may contain a lot of pictures, how to save it, or to build a separate picture attachment table, and then associated with the post ID?

4: If you are using cloud storage, such as seven bull and pat the cloud, after using their interface upload, will you return a picture URL? So do we save the returned picture URL in the database like above?

Since the site has many places to use the image upload function, each uploaded image in the server location needs to be recorded, then we do not specifically create a table to save all the uploaded image URL?

I think of the simplest design of this table: Imgup (ID, URL)

So simple, all the uploaded picture information is recorded here, such as the original user table avatar saved is the image URL, now you can save the corresponding ID can be, so much simpler, product pictures, post content pictures, ..., all the same.

But I always feel that this is too simple, too inappropriate, the table in the end how to design the most reasonable? Need to add some other information, such as the original name before the client was uploaded, image size, image size, image creation time, picture modification time, pictures exif information, ... Wait a minute.

Have not seen the DZ code, the post can see each attachment picture and other files, and can control permissions for users to download, do not know how it is done.

This problem is extended to the site "file upload" above is not limited to the picture, all the uploaded file information is placed in this record upload file information table inside, it is more convenient, management is also convenient, so this question I think for a long time, is no experience, so first to ask you the big God.

Hope that the experience of the great God to enlighten, pointing maze, I do not have teeth unforgettable, thank you!

No one answered?

The outer chain of the 1.UPYUN is the form:http://< space name >.b0.upaiyun.com/ <文件路径>
# <文件路径> You can define it yourself, you can refer to the Save-key detailed description
2. Refer to the Official SDK
3.DZ official plug-in you can see [DZ]
4. The same 2

I'm working on a similar platform now, and I'm using Nodejs to handle all the file requests. The naming method uses Uid/year-month/hash. Seven cattle words, see you are not private space, if not directly according to the bucket domain name stitching on the line. If it is a private space, you can get the file temporary download address using the SDK. Mobile phone, said a bit of a mess, forgive me

  • 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.