How to store image files in the backend of a site

I am creating a website and have just started developing backends.

A point on my site will display images to the visitor. For development purposes, I would like to check everything all over again before going live.

I would like to know how best to store these images. I just finished setting up my Wamp server and added a new db with phpMyAdmin. I found that I can store each image directly in mySQL database as a BLOB data type. But is this the best way to go?

Thank!

+5
source share
4 answers

This is definitely not the way to go. Then you need to save the blob in memory in PHP before sending it to the browser.

. , , -, PHP HTTP- .

+7

:

  • . (. ), , /.

  • . , .

- , PHP MySQL. MySQL , .

, , . .

:

?

- ?

+5

, . , ( ) ( imagick) -. , ( ), mysql .:)

dir/cache/pictures/$id_$width_$height.jpg . , $id_ $width_ $height .

0

I personally do not recommend storing files in the database itself. I would keep links to file locations so that in the future it would be possible to scale them in the case of mirrors, etc.

0
source

All Articles