I just installed TinyMCE + jbimages plugin to be able to upload photos from the editor directly. The upload works, but the display is breaking because of relative urls.
I add a blog post from http://localhost/laravel-5/article/create
and uploading an image works and it even displays the image in the editor.
The image path in the editor says ../images/display-error1.jpg
but after submitting it and going back to the blog's page localhost/laravel-5/articles
the image doesn't display. It's pointing to localhost/laravel-5/images/image.jpg
and skipping public
altogether.
This is the upload path config in tinymce/plugins/jbimages/config.php
$config['img_path'] = '/laravel-5/public/images'; // Relative to domain name
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . $config['img_path'];
How can I fix this? Thanks.
I found the answer here: https://www.tinymce.com/docs/configure/file-image-upload/#images_upload_base_path
Just add images_upload_base_path: '/base/path/to-images'