Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photos not showing in popup #661

Closed
HerbFargus opened this issue Jul 19, 2018 · 16 comments
Closed

Photos not showing in popup #661

HerbFargus opened this issue Jul 19, 2018 · 16 comments

Comments

@HerbFargus
Copy link

HerbFargus commented Jul 19, 2018

Qgis2Web Version: 3.1.1
QGIS Version: 3.0.2-Girona
Platform: Windows 10

I apologise in advance if this is a user error, if so disregard.

In my case I have a field with a list of URLS and I want the URLS to show up as a photo in the popup instead of an HTML Link.

Here is the layer:
test.zip

QGIS 3 is a bit different and has an attachment widget with options to specify an image or web view whereas qgis2.X just has a photo and web view widget on their own

image

If I set it to web view:
image

Using Identify in QGIS yields the following which is ideally how it will look in the web map:

image

If I export the layer in leaflet or openlayers I just get a clickable link:

image

If I set it to image:

image

basically the same, just a clickable link:

image

I'm not sure if this is due to the changes in QGIS3, or if I am misunderstanding how it is supposed to work (maybe I'm missing a setting?). I can manually generate HTML tables if I need to but I presume that automation is the main intent for the plugin.

Let me know if you need anything else, I'm happy to provide any logs or additional testing as needed.

@tomchadwin
Copy link
Collaborator

Others have reported this (https://twitter.com/SylMaithya/status/1012380722148139009), but there doesn't seem to be an issue here, so thanks for opening this.

My problem is that I can't investigate because I'm getting a QGIS crash when I set the widget type to Attachment. I've opened a QGIS issue:

https://issues.qgis.org/issues/19118

Until the QGIS issue is fixed, I can't really make any progress.

@magerlin
Copy link

Same issue here - and no problems setting widget type to Attachment
Win 7 64bit, QGIS 3.2.2
QGIS2Web 3.2.0

@magerlin
Copy link

Please note: Same problem is when using QGIS version 2.18.23 and setting widget type to Photo (or Web, my photos are on another web server)

@BenDienstl
Copy link

Hallo,

I had the same problem with my photos and i fixed it.

Openlayers:

Step 1:
Chose the widget type "Attachment" for the photos.
and write the photoname into the column like you did - redwood.jpg

To view the photos in the browser you have to go into the created js-files after exporting from qgis.

Step 2:

Go to the folder layers and open the layers.js and change

lyr_UmsetzungStecken2017_14.set('fieldImages', {'OBJECTID': 'Hidden', 'HR': 'TextEdit', 'ID': 'TextEdit', 'Shape_Leng': 'Hidden', 'Photo': 'ExternalResource', });

to

lyr_UmsetzungStecken2017_14.set('fieldImages', {'OBJECTID': 'Hidden', 'HR': 'TextEdit', 'ID': 'TextEdit', 'Shape_Leng': 'Hidden', 'Photo': 'Attachment', });

Step 3:

Go to the folder resources and open the qgis2web.js file

search for the popup

and change

if (layer.get('fieldImages')[currentFeatureKeys[i]] != "Photo") {
popupField += (clusterFeature.get(currentFeatureKeys[i]) != null ? Autolinker.link(String(clusterFeature.get(currentFeatureKeys[i]))) + '' : '');
}
to

if (layer.get('fieldImages')[currentFeatureKeys[i]] != "Attachment") {
popupField += (clusterFeature.get(currentFeatureKeys[i]) != null ? Autolinker.link(String(clusterFeature.get(currentFeatureKeys[i]))) + '' : '');
}

after this this, you can view the photos in the browser

Leaflet:

with the Leaflet_framework, you only have to open the index-file and search for the popupContent and change

\ Photo
' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + '\ \

to

\

\ \

Ben

@BenDienstl
Copy link

sorry

Leaflet:
change

\ Photo
' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + '\ \

to

\

@jukos
Copy link

jukos commented Jan 31, 2019

@BenDienstl or any other user with this knowledge

Leaflet:
change
\ Photo
' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + '\ \

to

\

to.....?
please write a text, I can not see the image....
Thank you and greetings

@jukos
Copy link

jukos commented May 8, 2019

Hello Tom,
any news?
You have created this ticket
https://issues.qgis.org/issues/19118
before 11 month......
Can I/we hope for the next version? Do you know anything?

To set attachments with images/videos for qgis2web, I must use QGIS 2.18.....but I would like work with QGIS 3.

Thank you for response.

Jürgen

Edit:
QGIS version 3.4.8: Still with the same bug. Hard to believe.....

@codefr3sh
Copy link

sorry

Leaflet:
change
\ Photo
' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + '\ \

to

![](images/' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + ')
\

@BenDienstl can you please explain the "to" part? It appears to be linking to an image of some sort. When I hover over the link it shows the same information as the "from" part.

Thanks!

@apenzin
Copy link

apenzin commented Sep 11, 2019

Hallo,

I had the same problem with my photos and i fixed it.

Openlayers:

Step 1:
Chose the widget type "Attachment" for the photos.
and write the photoname into the column like you did - redwood.jpg

To view the photos in the browser you have to go into the created js-files after exporting from qgis.

Step 2:

Go to the folder layers and open the layers.js and change

lyr_UmsetzungStecken2017_14.set('fieldImages', {'OBJECTID': 'Hidden', 'HR': 'TextEdit', 'ID': 'TextEdit', 'Shape_Leng': 'Hidden', 'Photo': 'ExternalResource', });

to

lyr_UmsetzungStecken2017_14.set('fieldImages', {'OBJECTID': 'Hidden', 'HR': 'TextEdit', 'ID': 'TextEdit', 'Shape_Leng': 'Hidden', 'Photo': 'Attachment', });

Step 3:

Go to the folder resources and open the qgis2web.js file

search for the popup

and change

if (layer.get('fieldImages')[currentFeatureKeys[i]] != "Photo") {
popupField += (clusterFeature.get(currentFeatureKeys[i]) != null ? Autolinker.link(String(clusterFeature.get(currentFeatureKeys[i]))) + '' : '');
}
to

if (layer.get('fieldImages')[currentFeatureKeys[i]] != "Attachment") {
popupField += (clusterFeature.get(currentFeatureKeys[i]) != null ? Autolinker.link(String(clusterFeature.get(currentFeatureKeys[i]))) + '' : '');
}

after this this, you can view the photos in the browser

Leaflet:

with the Leaflet_framework, you only have to open the index-file and search for the popupContent and change
\ Photo
' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + '\ \

to
\

![](images/' + (feature.properties['Photo'] !== null ? Autolinker.link(String(feature.properties['Photo'])) : '') + ')
\ \

Ben

Dear Ben,

Worked perfectly. I would like to know the code to link the thumbnail images of the popup with the image display at its original size and resolution in another tab in the browser. Is it possible?

I only tested on openlayers.

Amadeu

@jukos
Copy link

jukos commented Sep 24, 2019

Hello,
it looks like that the issue is solved:
qgis/QGIS#26948

Yes, this should bring images in popups back to life in qgis2web. However, no doubt there will be issues at the qgis2web end by now, as I've not looked at that code for a long time. Now that we have the QGIS bug fixed, and once you have a working version of QGIS with that fix, let's continue the discussion back on the qgis2web repo.
(Tom Chadwin)

@tomchadwin
To testing the improvement (+ possible adjustments within qgis2web) you must wait for the next QGIS version, or it is for you possible to test it earlier than
3.10.0 | 3.4.13 |   | 2019-10-25 ?

Greetings, Jürgen

@tomchadwin
Copy link
Collaborator

@jukos You can install the nightly, and test with that - that should have the upstream QGIS fix in it.

@jukos
Copy link

jukos commented Sep 24, 2019

Could you give me the link to "nightly"?
Thank you
edit: https://www.qgis.org/de/site/forusers/alldownloads.html#qgis-nightly-release
but not for windows....or linux?

@tomchadwin
Copy link
Collaborator

You can install the nightly via the OSGeo installer: https://qgis.org/en/site/forusers/alldownloads.html#windows

CAVEAT: I can take no responsibility for the installation of QGIS versions on your machine - please ensure you read up and understand how to do what you need.

@jukos
Copy link

jukos commented Sep 24, 2019

Hmm. I have tried the weekly version

QGIS-OSGeo4W-3.9.0-38-Setup-x86.exe 24-Sep-2019 15:14 411M  

without success (button is there, no crash.....but no image within qgis2web - same as before...). Only this version I could test. Problems with the other one.
I do not know, if the improvement is included in this weekly version...

Maybe another one can do any test. I think I must waiting to the regular qgis version.

Edit:
qgis/QGIS#26948
from me:

@m-kuhn
Is the new improvement included within this weekly-version?:
QGIS-OSGeo4W-3.9.0-38-Setup-x86.exe | 24-Sep-2019 15:14 | 411M |

answer from m-kuhn:

I assume so, yes.

I try it again.........

@jukos
Copy link

jukos commented Sep 25, 2019

Tom Chadwin:
qgis/QGIS#26948:

Now that we have the QGIS bug fixed, and once you have a working version of QGIS with that fix, let's continue the discussion back on the qgis2web repo.

(only) my test on the actual weekly 3.9 version: no button crash, but not yet images for qgis2web
I hope you can use this version for your analysis to get back the images.....
I hope also you have time the next days/weeks.

Greetings

@jukos
Copy link

jukos commented Oct 5, 2019

@ Tom Chadwin
It is possible to have the qgis2web photo / image function for qgis3 for the next qgis version

LTR/PR 3.10.0 3.4.13   2019-10-25

What do you think?

Thank you for answer and greetings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants