Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I am trying to develop one website where the users upload their images as part of their registration. I want it that for each image, there should be a thumb created with the  PHP (which is not that difficult). I also want to save the thumbs (since they are very small) in the database and I am using MySQL. (I don't want to save the thumbs as physical files on the drive.)

Does the MySQL allows saving and retrieving the image data and how do I do it? If it doesn't support the image data, is there any free database that does? I will be happy if a link can be provided.

1 Answer

0 votes
by (12.7k points)

Yes, you can be able to store the images into the database, but it is not advised, and it is not a general practice.

General practice is to store the images in the directories on the file system and store references to the images in the database. e.g. the path to the image, the image name, etc. Or alternatively, you can also store the images on a content delivery network (CDN) or numerous hosts across some great expanse of physical territory, and store the references to access those resources in the database.

Images can get very large, greater than 1 MB. And so storing the images in a database can potentially put unnecessary load on your database and the network between your database and your webserver if they are on different hosts.

Interested in SQL ? Check out this SQL Certification by Intellipaat.

For more information visit :

Related questions

0 votes
1 answer
asked Dec 31, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jul 18, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jan 7, 2021 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Jan 3, 2021 in SQL by Appu (6.1k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...