0

This is driving me crazy.

I added a couple of images to my theme. They are on my theme_name/web/images folder.

The images are returning a 404.

I delete the folder pub/static/frontend/vendor/theme_name/en_US and on the first access they load. As soon as I try to load the images again they return 404 again. The images are in the correct path.

Any ideas on what could be causing this? Permissions?

Hitesh Koshti
1,4454 gold badges18 silver badges38 bronze badges
asked Aug 16, 2017 at 15:36
4
  • Which code have you written to call images? Commented Aug 16, 2017 at 15:55
  • <?php echo $block->getViewFileUrl('images/selos/filename.svg'); ?> Any better solution? Commented Aug 16, 2017 at 16:05
  • Can you please share your image URL which you are getting by above code? Commented Aug 16, 2017 at 18:47
  • domain/pub/static/frontend/vendor/theme_name/en_US/images/selos/filename.svg I've tried with "Sign Static Files" set to yes and no. Both return the same result. Also tried replacing every svg file with png's. Nothing seems to work Commented Aug 16, 2017 at 22:27

3 Answers 3

1

Well, after days of looking into this problem I realised it had nothing to do with magento at all. Our designer was uploading the images trough Mega (client), and for some reason after I downloaded the images that problem occurred. After sending me the same images another the problem was solved.

answered Aug 18, 2017 at 16:46
0

I had the same case with facebook logo (svg). I assume the logo is in a compressed format. To fix the 404, I made a copy of the logo with inskape and replace the original image with the new file. After this process the image is four time bigger (600b for 2.2kb).

Teja Bhagavan Kollepara
3,8275 gold badges33 silver badges69 bronze badges
answered Jun 20, 2018 at 14:38
0

Call Media Images in PHTML Files

<img src="<?php echo $mediaUrl.'wysiwyg/demo.jpg'; ?>" />

Call Web Images in PHTML File

<img src="<?php echo $this->getViewFileUrl('images/demo.png'); ?>" />

Call Web Images in Static block and CMS page

<img src="{{view url="images/demo.jpg"}}" />

Call Media Images in Static block and CMS page

<img src="{{media url='wysiwyg/demo.png'}}; ?>" />
answered Aug 1, 2019 at 15:19

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.