5

How do you display a photo map tip in QGIS 3 on Windows?

As a new user I'm not sure if this is my lack of experience or a bug, so I've tried to simplify it as far as I can:

This is the contents of the Layer Display properties.

Properties -> Display

<div style="width:400;height:400">
<p>test</p>
<div><img src="C:\Local\aa.jpg" width="350" /></div>
</div>

and this is how it appears:

Maptip as it appears

C:\Local\aa.jpg is real file I'm using to try to figure out what the problem is. What am I doing wrong?

  • There's a forward slash at the end of the file path that looks out of place to me.Try <img src="C:\Local\aa.jpg" width="350"> instead of <img src="C:\Local\aa.jpg" width="350" /> – csk Mar 12 '18 at 19:19
  • That is for closing the img tag, which would be necessary in XHTML. I tried taking it out and it made no difference, thanks for the suggestion. – sandyscott Mar 12 '18 at 19:32
6

Will you add file:/// before the drive letter C: ?

<img src="file:///C:/Local/aa.jpg" width="350" />
  • That fixed it, thank you! I'd previously tried the file:/// thing (and swapping the backslashes to slashes, but hadn't realized that you need 3 slashes, not 2. – sandyscott Mar 14 '18 at 12:29
  • 1
    Thanks @sandyscott glad it worked. Yes, me too, tried 2 slashes first, then three by luck. – Kazuhito Mar 14 '18 at 14:02
  • This helped me, too. 3 slashes are required for Windows systems. Linux paths already have one at the start. file:///C:\Users\username\my_photo.jpg, vs file:///home/username/my_photo.jpg. – Dr John A Stevenson Mar 11 at 11:32
1

In HTML the way of adding a hint to an image is to use an alt attribute on the img tag.

Like:

<img src="C:\Local\aa.jpg" width="350" alt="Tip on test image" />

It is up to the client that parses the HTML whether or not it displays the text.

  • This doesn't work in Map Tip (on my system at least) – sandyscott Mar 14 '18 at 12:39

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.