Photo Naming different save locations

Hello

I would like to know if i can store Pictures in differnet folders.

Currently i have about 12 folders with named pictures.

My goal would be too name the picture in the Qfield app via an Attribute.

And store in a specific Folder automatically.

this proves quite difficult for me.

I already tried to modify the code line in Qgis.

But i never programed a line…..

So if anybody could help me or give me a Tip.

the photo is an attribute attachement no table

so only 1 picture per objekt which is fine for me

the Code lines look like this currently.

‘streckenschieber/’ || Concat(‘name’, “BEMERKUNG”)

this is the default line

‘DCIM/wasserleitung_’ || format_date(now(),‘yyyyMMddhhmmsszzz’) || ‘.{extension}’

how do i need to change this so it works

the folder itself is in the same directory as the qfield project if i link them manualy it works just fine

but it would be great if i can take a pictue name it and store it in the right spot all at once

Hi Martin!

Here is the method I use (sorry for the interface in french!) :

1 : Keep the default path as DCIM is the form informations

2 : Use the field you want to set as folder with a / :

3 : Securise the formula with coalesce() and replace( , ‘ ‘,’_’). This will prevent the formula to collapse if the field is null.

Works for me (‘Faune’ is the value stored in “Couche”) :

image

Here is the formula if you want to past it :

replace(
‘DCIM/’
||
coalesce(“Couche”||‘/’,‘Autres/’)
||
format_date( “Heure”, ‘yyyyMMdd_HHmmss’)
||
coalesce(‘_‘||“Entite”,’‘)
||
coalesce(’_’||“Nom”,‘’)
||
‘.jpg’
, ’ ', ‘_’)

Hello Felix

I did try to copy the line you Posted but QGIS tells me there are a few probemls with the line.

Different Syntax errors.

I am sorry but this is something i cant fix, as stated i dont know anything about coding.

So an error like this is a total roadblock for me.

Thanks for your help, i will see if i can fix this.

But i have little hope :sweat_smile:

Heya!

I think it may simply be a formatting issue caused by quotation marks changing during copying and pasting.

Try it like this:

replace(
'DCIM/'
||
coalesce("Couche"||'/','Autres/')
||
format_date( "Heure", 'yyyyMMdd_HHmmss')
||
coalesce('_'||"Entite",'')
||
coalesce('_'||"Nom",'')
||
'.jpg'
, ' ', '_')
1 Like