J
J
Johnick2018-04-26 09:36:41
PHP
Johnick, 2018-04-26 09:36:41

Extracting photos from MySQL?

Greetings.
I inherited a MySQL database with photos that are in a column with the VARBINARY type. Maybe someone will tell you how to properly convert them to base64 and then insert them into the img tag. Tried through base64_encode, but it didn't help. Perhaps some other modifications are needed?

screenshots of data in a column
Column type:
5ae172e4ac800035897016.pngData in cells:
5ae172f224301849997786.png

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Slon74, 2018-04-26
@Johnick

Judging by the fact that at the beginning there is a signature FF D8 FF E0 - this is a JPEG picture. Only here is its presentation, well, very atypical, well, or, this is how the Binary Editor strangely displays data. What data is in the column in "raw" form?

P
Papa, 2018-04-26
Stifflera @PapaStifflera

All transformations are in the code that writes the photo to the database.

D
Dmitry, 2018-04-26
@demon416nds

what's the point of your screenshot
, be it in text form, at least it was clear what kind of image format in the database

N
newpy, 2018-04-26
@newpy

Have you tried casting VARBINARY -> CHAR at the base level?

SELECT CAST(binaryColumn as CHAR) from table_name

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question