QGIS Image Hyperlink – How to Use Hyperlinks for Image Popups in a Web Map Based on QGIS 3.4.3

qgisweb-mapping

I have a point shapefile layer, that I added into it a hyperlinks row. Each hyperlink is for a image, all in me dropbox.
When I identify a point, I see the selected image.
However, when I export it to web map with QGIS2WEB plugin, I see only the hyperlink not the image. When I click on the hyperlink the image is open in a different window.
I like to see the image directly, can it be done?

Here are the steps I made:

In the layer properties I selected "Attachment" in the "Widget Type", I click on the "Use a hyperlink for document path (read-only)" and set the "Integrated Document Viewer" on Image type.

enter image description here

enter image description here

At this point I was able to create a hyperlink from the attribute table.
enter image description here

On QGIS the image is visible, using identify feature
enter image description here

As I wrote, when I use the QGIS2WEB plugin, I see only the link and not the image.
enter image description here

How can see these image directly?

Best Answer

If you export your map with qgis2web as Leaflet map, you can easily adapt the popup content in the index.html as you want to.

enter image description here

Open the exported index.html and look for var popupContent =
At this point, the popup content is defined as HTML table.

Just add another row at the bottom of the table in your popup-content definition and insert an <img>-Tag:

var popupContent = 
[...]
    <td><img src="' + (feature.properties['URL-attribute'] !== null ? Autolinker.link(String(feature.properties['URL-attribute'])) : '') + '" height="100px"></td>\
[...]

"URL-attribute" would correspond to your attribute with the imagepath inside.

Related Question