I
I
Imran Guseynov2014-06-20 18:04:14
PHP
Imran Guseynov, 2014-06-20 18:04:14

How to store photos in database?

A 16kb(jpg) photo is sent from the form. On the server, the script converts it to base64 and writes it to the database. When fetching from the database, it already weighs 250kb.
What is the reason for the increase in file size and how to get rid of it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Sustavov, 2014-06-20
@takovoy

we create a table, one of the columns of which is of a binary type, and write it there directly through the insert file.
In general, in the search it can be found on the first page
janicky.com/stati/sohranenie-izobrazhenij-v-baze-d...

A
Anatoly, 2014-06-20
@taliban

You can not convert to base64, but simply write binary data to the blob field, I suspect the size will increase in this case only slightly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question