What is the best way to store and retrieve images on a web server?

I have a website that is highly dependent on my sql database. I store product information in a database and extract and format it with php. I would like to add images to the equation, but I don't know where to start. They have high resolution, so I don’t think that storing them in a real database is recommended, but I don’t want other administrators to spend hours entering product information and images. Like coasters, admins fill out forms, verify the information is correct, and the information is saved and then displayed on the website. When it comes to images, the best I could come up with was to add the name and location of the image to the product information and call it back using php, but I don't want my admins to take all day to name the photos and manually enter the name .Any ideas are greatly appreciated.

+4
source share
2 answers

Personally, I would advise storing images in a reliable and scalable storage, such as Amazon S3 , which removes a lot of burden for you and allows you to place images through a cost-effective CDN at almost any scale (small or large).

, , . , md5 , S3 , , .

, , , , . , .

0

- -, , , CDN [, AWS S3], URL- URL- . , .

, , item_images , URL.

, , , URL- PHP , URL- src img.

<img alt="" src="<?php echo img_url[];?>" width="" class="">

:

  • , , enctype:

    <FORM id="" method="post" action="" enctype="multipart/form-data">
    
  • $_POST $_GET, $_FILES.

  • . .exe, .php .

  • GETIMAGESIZE().

  • MOVE_UPLOADED_FILE , .

  • - .

    $image_name=$item_category.$item_id.$extension
    
0

Source: https://habr.com/ru/post/1625367/


All Articles