Image title with photo taken by Ionic 4 Capacitor: Assigning a name to a Photo taken

Currently, I’ve been wondering if it is possible to assign an image title to the photos that are captured using the Ionic 4 Capacitor Plugin. I want to do this so that each photo has a predefined name so that the user doesn’t actually have to rename the file when it is saved to the gallery. I’ll be including my code for how I’m currently taking a photo below:

async takePicture() {
    const image = await Camera.getPhoto({
          quality: 100,
          allowEditing: true,
          resultType: CameraResultType.Uri,
          source: CameraSource.Camera,
          saveToGallery: true,
          promptLabelHeader: ''
          this.picturetext = 'Picture Taken';
 = this.sanitizer.bypassSecurityTrustResourceUrl(image.dataUrl);

I’m not sure what exactly you mean by “image title”, but if you mean “filename”, then I’d say “no”, at least for Android. Looks to me like filenames are generated by createImageFile.

Could we possibly do this in iOS instead? The app I’m developing on will be used only on the IOS platform. Would I just create a function for the CreateImageFile? Or do I have to go into the project files and make this change?

My best guess for where this gets done in iOS is here.

I would expect you would have to fork Capacitor and add this functionality, or convince somebody else to do so.

I don’t mean to sound callous or indifferent in the face of what you seemingly consider an important goal, but if I were a Capacitor maintainer, I would be inclined to WONTFIX this, because there would seem to me an insurmountable race condition baked into any attempt to micromanage file naming from the JavaScript side of the bridge. It is absolutely critical that newly generated files in this situation do not collide with existing files. If we can’t guarantee that, potential data loss occurs, and in this situation, potential catastrophic data loss if we inadvertently overwrite an irreplaceable memorial photo of a user’s dead loved one. If you try to initiate a collision check from the JavaScript side, I don’t see any way to guarantee that it’s still valid by the time the second call comes across the bridge to write the new photo.

All that being said, if you still want to go down this road, I would shift my attention later in the process, and investigate using Capacitor’s Filesystem to rename things after creation.