P
P
Pavel Novikov2018-11-11 17:26:30
PHP
Pavel Novikov, 2018-11-11 17:26:30

How to save base64 images from WYSIWYG editors to database?

Good afternoon,
there is a WYSIYG text editor (in my case it is CKEditor). The user should be able to edit articles and insert images (base64) into them.
The question arises, how to save texts with encrypted images? You can’t write it directly to the database, since the hash of the image can be too long, I also somehow can’t see the text parsing.
The only idea I have is to write texts to separate files (eg yaml) and edit them. But perhaps there is someone here who is more experienced than me in these matters and can help me :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2018-11-11
@paulfcdd

usually editors have events for inserting pictures. did this in summernote. you just need to subscribe to this insertion event, send the image to the server with Ajax, get a permanent link to the image from it and replace the img src with this constant in the editor. thus, when saving, the code will only have a link to the image. and the picture is a regular file on the disk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question