I am making an inventory of certain buildings in a city. In the object attributes, I'm - amongst other infos - linking to pictures of that building, so that in the layout, for each building, you have a map that shows the location of the building, a description of the building and some pictures of it.
There is a possibility to add up to five pictures, but not all buildings will have five (e.g. in some cases, we only have a picture with a general view of the building, in others we will also have pictures with details of certain parts of the construction). First I noticed, that big crosses are shown when a building doesn't have all five pictures, so I added a
CASE WHEN ELSE, which makes sure that when there is a picture, the picture is shown, but when there isn't one, there is just nothing instead of a big cross:
CASE WHEN "Foto_2" > 0 THEN @project_home + '/' + "Foto_2" ELSE ' ' END
That works very well, but now, I noticed that portrait pictures are automatically turned and shown as landscape pictures. Is there a way to have an automatic check whether a picture is portrait or landscape and have it adapted accordingly? Because depending on the building, each picture could be landscape or portrait, it's unfortunately not so that for each building picture 1 is landscape, picture 2 is portrait etc.
I would need something like:
CASE WHEN "Foto_2" < 0 THEN ' ' ELSE WHEN bounds_width($area) > bounds_height($area) THEN @project_home + '/' + "Foto_2" landscape ELSE @project_home + '/' + "Foto_2" portrait END
That doesn't work, but I don't know how to describe the landscape/portrait requirement, nor how to build multiple
WHEN ELSE THEN-checks).