Change the name of the photo file what we want in QFIELD

Describe the issue

[How to name a photo according to the field we want at QFIELD? For example, I have a photo code field that contains the code “J0001” onwards, because every resulting image file name in qfield seems to be automatically named using the date it was taken]

Expected behavior

[I want the name of the photo after export according to the field without changing one by one, how do I do it? I think this uses a coding system. I’m not very good at it]

Desktop (please complete the following information)

  • OS: [e.g. Windows]
  • QGIS Version [e.g. 3.22.0]
  • QFieldSync Version [e.g.4.0.0]

Mobile (please complete the following information)

  • Device: [e.g. Xiaomi Mi 8]
  • OS: [e.g. Android 10]
  • QField version: [3.2.2]

Additional information

  • Problem started happening recently, didn’t happen in an older version of QField: [Yes]
  • Problem can be reliably reproduced, doesn’t happen randomly: [Yes]
  • Problem happens with all files and projects, not only some files or projects: [No]

Imported from GitHub discussion by @Bagaszed on 2024-05-19T16:57:01Z

Hi,

When you have a field that allows taking pictures using the ‘Attachment’ widget, you can configure the attachments in the properties of the layer (QFIELD tab).

From there, you can use an expression to name your pictures. For example, you can use the field that contain your “codes”.


Imported from GitHub comment by @Ipickedausername on 2024-05-19T17:27:37Z

for example i want to do that can QFIELD do that?, i mean the name of file image automaticly fill like that


Imported from GitHub comment by @Bagaszed on 2024-05-19T18:04:25Z

Hi,

When you have a field that allows taking pictures using the ‘Attachment’ widget, you can configure the attachments in the properties of the layer (QFIELD tab).

From there, you can use an expression to name your pictures. For example, you can use the field that contain your “codes”.

I’ve done that, but the result is the same :frowning:


Imported from GitHub comment by @Bagaszed on 2024-05-19T18:32:23Z

Hello,

I tried with a test project and I have the same issue indeed.
'DCIM/suivi-pt_' || Concat("name", "FOTO_TGH", "FOTO_UIG", "KD_FOTO") || '.{extension}'

I add a test project for a Dev who certainly can do a better check.

test_tabs_Qfield (2).zip


Imported from GitHub comment by @Ipickedausername on 2024-05-20T21:11:35Z

I am trouble shooting a similar naming issue. Pics are default named and not by the expression. I noticed however, that if I created the feature containing the pic record (i.e. saved it), then selected it and edited it to add a pic, the renaming worked as coded. Anyone else?

I see here that someone else mentions saving first…


Imported from GitHub comment by @roydenyates on 2024-06-07T17:51:06Z

On the phone/tablet go to Qfield settings and enable “Fast Editing Mode”.

That solved the renaming issue for me, as the expression with variables is then honoured.


Imported from GitHub comment by @roydenyates on 2024-06-07T18:55:49Z

I’ve tested photo naming using the sample bees project with both native and non native camera on Android and couldn’t replicate this issue. It’ll likely take someone to share a small project that shows the issue to investigate this further.


Imported from GitHub comment by @nirvn on 2024-06-08T12:40:32Z