On 27 Oct 2016 7:18 AM, "Bernd Vogelgesang" <[email protected]> wrote: > > Am 26.10.2016, 22:57 Uhr, schrieb Nyall Dawson <[email protected]>: > >> On 27 Oct 2016 6:51 AM, "Bernd Vogelgesang" <[email protected]> wrote: >> > >> > Arghh, sorry for the noise! >> > >> > When hovering over the data-driven input button not so hectically, I discovered the explanation that it expects a 0 or 1. >> > So >> > case when >> > 'mypath'|| @atlas_pagename ||'_1.jpeg' IS NULL >> > THEN >> > 0 >> > END >> > >> > did the trick! >> >> This is odd... A null picture expression should be rendered empty, not as the red cross. The red cross is intended only as an obnoxious, obvious indicator that a picture path was set but couldn't be found. >> >> The expression above would only result in 0 if @atlas_pagename is null. >> >> Nyall > > > Well, yeah, I was too early to announce the solution. In fact this did not render the missing image, but also not the one which is there :( > > case when > '/media/Daten/IVL_Projekte/2016024_Feldhamster_NEA/2_EINGANG_MA/Bernd/QGIS/Fotos/'|| @atlas_pagename ||'_1.jpeg' IS NULL > THEN > 1 > ELSE > 0 > END > > This should do it. But now I am again where is started: When the image is there, it is rendered, when not, the red cross is exported as well.
That's because that expression is just testing whether the concatenated string itself is null, not whether the corresponding file actually exists. My advice: make a small python custom function 'file_exists' which checks for the existence of a file. Then change your picture path expression to something like: Case when file_exists( 'media/' ... Etc) then 'media/' ... Else null end That should get you the result you are after. Nyall > > :( > > Bernd > >> > >> > Just amazing!!! >> > >> > Thanx >> > Bernd >> > >> > Am 26.10.2016, 22:19 Uhr, schrieb DelazJ <[email protected]>: >> > >> >> Hi, >> >> what about using the data-defined option near the "Exclude items from export" in the items properties --> Rendering (with a case when expression)? >> >> http://docs.qgis.org/2.14/en/docs/user_manual/print_composer/composer_items/composer_items_options.html#rendering-mode >> >> >> >> HTH, >> >> Harrissou >> >> >> >> 2016-10-26 22:10 GMT+02:00 Bernd Vogelgesang <[email protected] >: >> >>> >> >>> Hi, >> >>> I set up a neat atlas for displaying a row of 50 sample plots. On a second page, I want to show 2 pictures taken of these plots automatically with an expression including the path || @atlas_pagenumber || '_1.jpeg' or '_2.jpeg' to display up to two photos named e.g. 1_1.jpeg, 1_2.jpeg. >> >>> >> >>> This works really great! The problem is, that for some plots, we do not and have any picture or only one. In composer, these missing images are marked with a big red cross. >> >>> Unfortunately, these red crosses are also exported, which looks quite shitty. >> >>> >> >>> Is there any clever way of forcing QGIS not to export these place holders but just not to print anything at this place? >> >>> >> >>> The only (boring) idea I came up with till now, was to create empty white images and name them accordingly to avoid the red crosses. >> >>> >> >>> Thanx >> >>> Bernd >> >>> >> >>> -- >> >>> Bernd Vogelgesang >> >>> Siedlerstraße 2 >> >>> 91083 Baiersdorf/Igelsdorf >> >>> Tel: 09133-825374 >> >>> _______________________________________________ >> >>> Qgis-user mailing list >> >>> [email protected] >> >>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user >> >>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user >> >> >> >> >> > >> > >> > >> > -- >> > Bernd Vogelgesang >> > Siedlerstraße 2 >> > 91083 Baiersdorf/Igelsdorf >> > Tel: 09133-825374 >> > >> > _______________________________________________ >> > Qgis-user mailing list >> > [email protected] >> > List info: http://lists.osgeo.org/mailman/listinfo/qgis-user >> > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user > > > > > -- > Bernd Vogelgesang > Siedlerstraße 2 > 91083 Baiersdorf/Igelsdorf > Tel: 09133-825374
_______________________________________________ Qgis-user mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
