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?

  • Which code have you written to call images? – Prashant Valanda Aug 16 '17 at 15:55
  • <?php echo $block->getViewFileUrl('images/selos/filename.svg'); ?> Any better solution? – Cátia Rodrigues Aug 16 '17 at 16:05
  • Can you please share your image URL which you are getting by above code? – Abhishek Panchal Aug 16 '17 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 – Cátia Rodrigues Aug 16 '17 at 22:27
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.

|improve this answer|||||
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).

|improve this answer|||||
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'}}; ?>" />
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.