Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photo is always cropped to square on iOS 17 #2097

Open
kallewangstedt opened this issue May 6, 2024 · 3 comments
Open

Photo is always cropped to square on iOS 17 #2097

kallewangstedt opened this issue May 6, 2024 · 3 comments
Labels
platform: ios type: bug A confirmed bug report

Comments

@kallewangstedt
Copy link

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

@ionitron-bot ionitron-bot bot added the triage label May 6, 2024
@ionitron-bot ionitron-bot bot removed the triage label May 6, 2024
@kallewangstedt kallewangstedt changed the title Photo is always cropped to square on iOS 15 Photo is always cropped to square on iOS 17 May 6, 2024
@IT-MikeS IT-MikeS added the type: bug A confirmed bug report label May 13, 2024
Copy link

ionitron-bot bot commented May 13, 2024

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.

@masonicboom
Copy link

@kallewangstedt try setting allowEditing: false

@OS-ricardomoreirasilva
Copy link
Collaborator

@kallewangstedt, have you tried what @masonicboom suggested? The behaviour you're reporting is the one that Apple provides for iOS' UIKit. UIImagePickerController enables a basic built-in image editing interface that allows the user to perform some sort of crop and scale before returning it.
If you disable the allowEditing property, the square border should disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios type: bug A confirmed bug report
Projects
None yet
Development

No branches or pull requests

5 participants