Magento2: WYSIWYG Image URL is incorrect on the frontend

Created on 3 Nov 2016  路  6Comments  路  Source: magento/magento2


I tried to insert an image to a content of a category. The image is shown on the WYSIWYG editor. However, when I go to the front end, it throws error 404 because the path is wysiwyg/water-safety/someimage.jpg. I ended up have to modify the HTML code to use the full path pub/media/wysiwyg/water-safety/someimage.jpg instead

Preconditions


  1. Magento version 2.1.2
  2. PHP version 7.0.12
  3. MySQL version 5.6.33

Steps to reproduce

  1. Login to the admin dashboard.
  2. Go to categories.
  3. Select on of the subcategories.
  4. Edit the content via WYSIWYG.
  5. Insert image into the content.
  6. Save the category.
  7. Go to the front end and view the category.

Expected result

  1. I expect to see the image to show on the content section of the category.

Actual result

  1. It shows broken link for the image because the path wysiwyg/water-safety/someimage.jpg is not found. I had to manually change it to pub/media/wysiwyg/water-safety/someimage.jpg instead.

Catalog Ready for Work bug report

Most helpful comment

Magento 2.2.0 still has the same issue. This is a severe issue as a developer cannot train a normal folk to fix the image url by teaching them html, it's just too much... and it contradicts the purpose of wysiwyg. I end up stuck with having to support them whenever a client wants to use the cms (i.e a new blog post).

If you simply use wysiwyg to add an image by click on the image icon button, it will use an absolute url and after saving it, the image goes broken.

If you hide the wysiwyg and use Insert Image... button, it will use variable {{media url="..."}}, which gives you correct url and you won't have any issues.

Magento has problems with wysiwyg since it's birth, sadly to see the team has no intention to make a difference in M2.

All 6 comments

Same issue, but with all WYSIWYG images using the Magento image shortcode {{media url=.

There's lots of older posts about this problem, but I haven't seen a Magento 2 solution.

Thanks for reporting, we are aware about this issue and working on it
MAGETWO-58156

Closing as duplicate

Thank you

Same issue How long will it take to solve The image is shown on the WYSIWYG editor.

Magento 2.2.0 still has the same issue. This is a severe issue as a developer cannot train a normal folk to fix the image url by teaching them html, it's just too much... and it contradicts the purpose of wysiwyg. I end up stuck with having to support them whenever a client wants to use the cms (i.e a new blog post).

If you simply use wysiwyg to add an image by click on the image icon button, it will use an absolute url and after saving it, the image goes broken.

If you hide the wysiwyg and use Insert Image... button, it will use variable {{media url="..."}}, which gives you correct url and you won't have any issues.

Magento has problems with wysiwyg since it's birth, sadly to see the team has no intention to make a difference in M2.

Was this page helpful?
0 / 5 - 0 ratings