Why do the images not display?

I added a “public” top-level folder to my Meteor project, and to it an “images” folder, into which I copy-and-pasted an image file.

I’ve got this HTML in my main html file:

<head>
  <title>Formless and Waste</title>
</head>

<body>
  <h1>Form Help</h1>

  {{> preTravel}}
  {{> postTravel}}
</body>

<template name="preTravel">
  <h2>Pre Travel</h2>
  <img src="cdtASCXLess.png" alt="pre Travel image" height="42" width="42">
</template>

<template name="postTravel">
  <h2>Post Travel</h2>
  <img src="\public\images\cdtASCXLess.png" alt="post Travel image" height="42" width="42">
</template>
</pre>

Yet the images don’t display (whether I supply the path or just the file name) - they display with the “busted image” icon in the NW corner and part of the alt value in the rest of the box.

What am I missing to get these images to display?

There are two issues here:

  1. URLs need to have forward slashes ( / ) not backslashes ( \ )
  2. The public/ part shouldn’t be in the URL

So the result would be:

src="/images/cdtASCXLess.png"

Let me know if that works!

2 Likes

Yep, that works like a charm bracelet - thanks!

1 Like

Hi Clayshannon,

I have an image under “public/_assets/img/ball1.png” and in my HTML file I have the following:

test

This works when I deploy the code to iOS devices, but it doesn’t work when I deploy to Android devices.
AreI you are able to see the image on the Android devices?

Thank you,

Brian

Sorry, I haven’t worked with Meteor for a year; not that I didn’t think it was great, it’s just that I could only do it as a hobby, and don’t have the time for that. I’m on to other things: https://www.facebook.com/AdventuresOfMarkTwain/

Hi sashkoMDG Staff,

I am glad that your issue has been resolved.
I have similar issue with image not displayed on Android devices.
Does your app runs and displays the images on android devices?
My app display the image on iOS devices, but was not able to display on Android devices.
Can you please confirm that your app was able to display image from the public folder on Android devices.

Thank you,

Brian

Hi Sashko,

I have the same problem with clayshannon and try to follow your advice.
But nothing change, still can’t display the image. Here is my code:

Do you have any idea what went wrong?
Thanks