capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

Photo is always cropped to square on iOS 17

Open kallewangstedt opened this issue 9 months ago • 2 comments

Bug Report

Plugin(s)

@capacitor/camera v6

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/android: 6.0.0
  @capacitor/ios: 6.0.0

Installed Dependencies:

  @capacitor/android: not installed
  @capacitor/cli: 6.0.0
  @capacitor/core: 6.0.0
  @capacitor/ios: 6.0.0

[success] iOS looking great! 👌

Platform(s)

iOS

Current Behavior

Efter taking a photo a square crop border is shown, and the image can not be moved inside the border. When 'Use Photo' is pressed, the image is cropped and inserted into the app. Se image below.

IMG_1570

Expected Behavior

The image should not be cropped and should preserve aspect ratio.

Code Reproduction

  async photo(uuid: string, sourceType: number) {
	if (((await Camera.checkPermissions()).camera) === 'denied' || (await Camera.checkPermissions()).photos === 'denied') {
		if (sourceType === 1){
			await Camera.requestPermissions({ permissions: ['camera'] });
		} else {
			await Camera.requestPermissions({ permissions: ['photos'] });
		}
	}

    const image = await Camera.getPhoto({
      quality: 100,
      allowEditing: true,
	  width: 3024,
	  height: 4032,
      resultType: CameraResultType.Base64,
      source: sourceType == 1 ? CameraSource.Camera : CameraSource.Photos,
	  promptLabelCancel: 'Avbryt',
	  promptLabelPhoto: 'Ta foto',
	  promptLabelPicture: 'Välj bild',
	  promptLabelHeader: 'Välj bildkälla',
    });
    const skold = [
      { bild: { url: `data:image/jpeg;base64,${image.base64String}` } },
    ];

    this.broder.skold = skold;
    this.broder.img = image.base64String;
  }

Other Technical Details

vsCode Version: 1.88.0 (Universal) Commit: 5c3e652f63e798a5ac2f31ffd0d863669328dc4c Date: 2024-04-03T13:28:18.899Z (1 mo ago) Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Darwin arm64 23.4.0

Additional Context

kallewangstedt avatar May 06 '24 21:05 kallewangstedt

This issue has been labeled as type: bug. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.

ionitron-bot[bot] avatar May 13 '24 15:05 ionitron-bot[bot]

@kallewangstedt try setting allowEditing: false

masonicboom avatar May 20 '24 22:05 masonicboom