Git Product home page Git Product logo

Comments (13)

andreaordonselli avatar andreaordonselli commented on June 21, 2024

You can consult the documentation at this address: https://qgis2web.github.io/qgis2web/#setLayers

This is specifically described in the Image or Video subchapter:

Image or Video If you want to show images or video in popup you must set Widget Type to "Attachment" and do not change other values. Only the Absolute path is supported: enter image description here
image

Set the absolute path as the field text:
image

The result in your map will look like this
image

or this, for video
image

For the width of the popup you can edit the qgis2web.css file present in the "resources" folder of your export. Increase these values

    th {
        min-width: 100px;
    }
    td {
        min-width: 100px;
    }

Warning: the popup would probably be larger if you exported with the full-screen template rather than canvas-size. You can find the option in the Appearance tab of the plugin.

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

Thank you for responding. I have consulted the Wiki and various similar questions. In case I had made a mistake in changing the widget to 'Attachment' I re-added the file and setup the widgets again, changing on the 'Widget type' to 'Attachment' in the relevant attribute field. I attach my screenshot so you can see how the widget looks if I only change Widget type to Attachment. I also changed the Appearance to 'full-screen' template rather than canvas size, but I am getting exactly the same result. The popup appears perfectly except that the image is represented by an 'image icon' instead of appearing in the popup.
2024-05-22 (1)

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

can you provide a screenshot of the data table to see the paths to the images? another thing, after exporting you can right click on the icon in the popup that you see instead of the image and select inspect? what does the browser console show you? can you make a screenshot of this too?

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

Here is the screenshot of the attribute table showing the paths - the two images are jpgs on my D drive as you can see.
2024-05-23

And here is what the browser console shows me if I right click the icon and select inspect.
image

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

In the browser console, extend the tr and its children until you get to the "img" element, that is the path where the image is searched for, what path is written there? Do you notice a strange path? It should point to the "images" folder of the exported project.

Make sure the image link you wrote D:/ etc... is correct.

Do these tests in the local export before uploading it to hpethen.github.io, I don't want images to be excluded when uploading to the site.

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

So I haven't uploaded anything to Github since my original post. I expanded the tr and its children. Here is the screenshot:

2024-05-23 (5)

The filepath to the image in the screenshot is correct. When I hover over the link it gives me the whole link to qgis2web folder on my local machine, followed by the filepath of the image from the attribute table. Like this:

Filepathlink

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

Everything seems correct. I don't understand the problem. Can you send a zip with your qgis file, data and images?

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

I agree it does seem odd. Here is the zip. You'll have to redirect the absolute paths of course, but the shapefiles and images are all there.
QGIS2Web_attachmenttest.zip

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

I changed the path to point to the jpg files in my folder.
2024-05-23 16_21_46-Gharbiya_Delta_Survey_Sites — Features Total_ 11, Filtered_ 11, Selected_ 0

I changed the field to Attachment.
2024-05-23 16_21_30-_EES Delta Survey Sites from Gharbiya Governorate — QGIS

I exported. Works.
2024-05-23 16_22_03-

I don't understand what the problem could be with your PC.
Here exported project:
qgis2web_2024_05_23-16_21_00_269526.zip

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

How odd - maybe I just need to rebuild it? Thank you for your help. I will rebuild it and see if it works.

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

Double check the path to the jpg files and the attachment setting of the field.

from qgis2web.

hpethen avatar hpethen commented on June 21, 2024

I've FOUND it! My computer has both an internal C and D drive and I normally use the D Drive for my documents because that's the SSD! When I shifted the images to the C Drive, the attachment worked and the images now appear in the QGIS 2Web export!

from qgis2web.

andreaordonselli avatar andreaordonselli commented on June 21, 2024

I'm glad you solved it.

Please consider donating a virtual coffee via the button on the home page for qgis2web development and support.

Thank you.

from qgis2web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.