2

I was happily using html popups with QGIS 2.8.3 for various things including a showing a photo. However, I've updated to 2.18 to take advantage of other new functionalities, and now find that my html popup will no longer show the photo the way it used to.

This is the html I'm trying to use:

<img src="Camera/[%PHOTO_1%]" width=150>

The image name is in field PHOTO_1 and the image is in a subfolder named Camera (subfolder on same level as qgis project).

With version 2.8.3, the html provided showed the photo. With version 2.18, I only have a blank popup.

I've now tried it two additional ways without success:

<img src= "@project_folder + '/Camera/' + [%PHOTO_1%]>

and

<img src= [% @project_folder + '/Camera/' + "PHOTO_1"%]>
1

Try this;

<img src= [% @project_folder + '/Camera/' + "PHOTO_1" %] alt= "My_Photo_1" width= 150/>

Nothing special, however;

  • Remove double quotation marks around [% %] ...... (this is confusing... a bug?)
  • Use full-path. project variables may help.
  • I can't seem to get your example to work. How come we should put the project_folder variable and '/Camera/' within the field name brackets [% %]? – user25976 Jun 2 '17 at 23:27
  • @user25976 It is because your project file (.qgis) and the photos are separated, as in your Camera folder. The important point is to use Full-path. @project_folder variables helps us to shorten the path. – Kazuhito Jun 2 '17 at 23:35
  • Sorry to be a broken record, but it's still a no-go. To be clear, the field 'PHOTO_1' contains only the file name e.g. '20170403.jpg'. It is just in the html specification that the '@project_folder' variable is called. Seems right to you? – user25976 Jun 9 '17 at 21:07
  • It looks fine to me the field "PHOTO_1" but are you sure you put it in single quote? It should be in double quote mark (" "). Or if @project_folder variable does not work, please start with simple absolute path such as [% 'C:/your_path_to_Camera_folder/' + "PHOTO_1" %] and see if it works. – Kazuhito Jun 9 '17 at 23: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.