Jump to content
Server Maintenance This Week. ×

Image not displaying in web viewer


BruceB

This topic is 2551 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

I am trying to display an image (from disk) in a web viewer.

The following is the calculation entered into the web viewer (by means of a calculation):
 

data:text/html,
<body>
<p>Hello</p>
<div>  <img src="Maths_AS/Questions/q1.png" style="width: 700px">  </div> 
<p>Good-bye</p>
</body>

The text displays, but the img tag just produces a small box with an X.

When I use the following in a simple html file and display it using a browser (Firefox, Chrome), it displays correctly. In both cases the file references are relative; both the FMP file and the html file are stored in the same directory, from where the image is referenced.

<html> <head> </head> 
<body>
<p>Hello</p> 
<div><img src="Maths_AS/Questions/q1.png" style="width: 700px"></div>
<p>Good-bye</p>
</body>
</html>

I am using Windows 10 Professional with FMP Advanced v.11.

I would be most grateful for some help here!

Thanks in advance
Bruce

 

Link to comment
Share on other sites

7 hours ago, BruceB said:

both the FMP file and the html file are stored in the same directory, from where the image is referenced.

The problem here is that when you're using the data URI scheme, there is no real HTML file. There is only a virtual HTML document - which cannot be found in any directory on your hard disk. You can see this by loading the following code into your web viewer:

"data:text/html,
You are here:
<br/>
<script>
document.write(window.location.href);
</script>"

Possible solutions:

1. Use an absolute reference to the image file;

2. Embed the image data in the HTML code.

 

Edited by comment
Link to comment
Share on other sites

This topic is 2551 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.