1

In QGIS 3.16. This is related to this question and this question for which the only posted answers do not solve my problem.

I am creating a report with a field group section; the goal is to have 1 page per feature, with various attributes of each feature displayed on the page. One attribute is 'Image' which links to a .JPG (via Layer Properties-->Attributes Form-->Widget Type = Attachment).

In order to display the image on the page, I have done the following: 'insert image', then in Object Properties, 'Data-defined value', and from the menu, "Field type: string" and select the 'Image' attribute.

When I do that, the image box is filled with a giant red X. If I try to export the report to PDF, I get a two-panel error message; the top panel reads "The image source is missing or corrupt", and the bottom panel reads "The source of the image cannot be loaded or is corrupt" followed by the correct name of the .JPG file it attempted to load.

The files are not missing or corrupt; the attribute is the correct type (String, with a sufficiently long character limit), the 'Image' link works fine in the Identify Features form window, and the images are visualized as expected. It is only here in the Report view that it seems to be getting jammed somehow.

Edit: here is a link to 5 screenshots showing 1)How the image is linked to the field; 2)Correct display of the image via the "Identify features" tool; 3)How the image source is selected for the report; 4)The way the image object displays in the report; and 5)The error message when attempting to export to PDF.

3
  • 2
    can you add a screenshot which shows how the image is linked in the attribute table (relative or aboslute) and what the expression is, that you are using for the report?
    – eurojam
    Oct 26, 2021 at 4:57
  • sure @eurojam, I've just added a link to 5 screenshots (uploaded to imgur so as not to take up too much space here). I think it adresses your question; please let me know if it's not clear.
    – pete
    Oct 27, 2021 at 8:49
  • I should add that while my screenshot shows a relative path for the link, I have tried it using absolute path (as suggested in the QGIS documentation) and I get exactly the same result.
    – pete
    Oct 27, 2021 at 9:26

1 Answer 1

0

The issue is functionally solved for my case. Here are some things I had to do in order for it to work:

  1. I created an Atlas, rather than a Report;
  2. I inserted an image, rather than a label or an html object (two suggested alternatives);
  3. I sourced the image simply by naming the field in the expression editor, rather than selecting the field from the data-defined value menu, or using a more complex expression (the full file path seems not to be necessary);
  4. Also, when setting the parameters in the Attributes form menu, I had to make sure that the file path was absolute (not relative) and that the file was a JPG (and not a PNG).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.