knnnrd's avatar

Editing posts made with WYSIWYG editor + image upload

Hello, I'm having problems with embedding images in blog posts. Storing images in a NEW blog post is working so far, (but my code is not very clean and reusable).

Editing a blog post that has images in it is not working at all and I can't figure out how to tackle this.

How it's currently working: I'm using summernote as WYSIWYG editor. Uploading an image in a NEW blog post is working so far. In my store method, I get all the img elements from the html. I generate a name and then I use intervention to save the image. After that I change the src attribute of every image to a relative path with the new name and save this new html to the database. In my views, I prefix the src of the img elements with the public_path() helper using jQuery.

0 likes
1 reply
Snapey's avatar

you probably need to persist the raw text from the original submission so that you can return it for editing.

1 like

Please or to participate in this conversation.