For each feature I want a picture related to that feature. So its obvious to have written a path in the tables attribute. Then I´ll label that attribute somehow by brackets like [%path%]. But it´s not that simple and need some guidance how to write it correctly?


If you print using the Atlas feature from the Print Composer you can databind a column with the entire file path to a composer image.

enter image description here

  • Yup, I´ve found out too :-) – CARTOS Dec 2 '15 at 10:56
  • Would you mind to show the variable introduced to databind the path with the entire file path? I'm not available to do it. Thanks – César Herrera Apr 5 '18 at 11:46

Another convenient way to get the path of your pictures if they are located in your project directory is to use the project_folder variable from Field calculator:

enter image description here

This is especially useful in the print composer or Atlas when using a relative save path for your project since if you move the whole project folder, the picture path will be updated in the image source.

An example of the syntax would be:
@project_folder ||'/field_pictures/'||"picture_id"

This is will retrieve the project folder path, then goes to the picture folder path and finally retrieves the picture_id from your attribute table.

And finally if you have some features which don't have a picture linked to it, you can avoid the ugly big red cross filling the blank image space by using a condition such as:
CASE WHEN "picture_id" is not null THEN @project_folder ||'/field_pictures/'||"picture_id" ELSE ' ' END

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.