Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question