Comments (13)
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
Set the absolute path as the field text:
The result in your map will look like this
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.
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.
from qgis2web.
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.
Here is the screenshot of the attribute table showing the paths - the two images are jpgs on my D drive as you can see.
And here is what the browser console shows me if I right click the icon and select inspect.
from qgis2web.
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.
So I haven't uploaded anything to Github since my original post. I expanded the tr and its children. Here is the screenshot:
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:
from qgis2web.
Everything seems correct. I don't understand the problem. Can you send a zip with your qgis file, data and images?
from qgis2web.
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.
I changed the path to point to the jpg files in my folder.
I changed the field to Attachment.
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.
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.
Double check the path to the jpg files and the attachment setting of the field.
from qgis2web.
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.
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)
- QGIS2web keeps failing with python errors HOT 13
- qgis2web 3.18.2 crashs since QGIS v3.36.0 at Win & Mac HOT 1
- Nested layer groups are still not supported HOT 1
- Warning: QgsVectorFileWriter.writeAsVectorFormat() is deprecated HOT 3
- Learning how to contribute HOT 1
- UKHab Style Sets Not Working HOT 9
- The export contains malware HOT 4
- max-height of popup-content HOT 2
- Python error HOT 1
- Unable to export with openlayers HOT 12
- Blank preview and map HOT 5
- Python error HOT 4
- WMS Map from geoportale.regione.lazio.it not showed HOT 8
- Incorrect translation from Dutch names (look like English) in the Dutch language again. HOT 2
- popup join data - popup link - popup video HOT 4
- Layer Search not working with Geopackage fid HOT 6
- Popup boxes appear vertically elongated with lots of content rather than wide enough to accommodate the information HOT 4
- Diagrams are not supported - Do not use apostrophe in fields HOT 9
- export page is blank HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qgis2web.