Skip to content
This repository has been archived by the owner on Nov 29, 2022. It is now read-only.

Setting cropMode to square doesn't crop the picture #141

Open
pktrkts opened this issue Aug 8, 2017 · 1 comment
Open

Setting cropMode to square doesn't crop the picture #141

pktrkts opened this issue Aug 8, 2017 · 1 comment

Comments

@pktrkts
Copy link

pktrkts commented Aug 8, 2017

Hi,

I'm trying to use your library so that I can crop pictures that are in the photo library to a square. My code:

self?.picker = UIImagePickerController()
//self?.picker = DZNPhotoPickerController()
self?.picker?.delegate = self
self?.picker?.sourceType = .photoLibrary
//self?.picker.allowsEditing = true
self?.picker?.cropMode = DZNPhotoEditorViewControllerCropMode.square
//self?.picker.cropSize = CGSize(width: 200, height: 200)
self?.present((self?.picker)!, animated: true, completion: nil)

I admit that I haven't tried setting self?.picker to DZNPhotoPickerController(), mainly because I'm not entirely sure which methods I need to override for the delegate. Unless I have to use this class to get the square picture, however, I'm happy with using UIImagePickerController and just cropping the picture. This line self?.picker?.cropMode = DZNPhotoEditorViewControllerCropMode.square does not work as expected and I still get rectangular pictures. How do I change my code so I get square pictures?

Thanks,
Sean

@pktrkts
Copy link
Author

pktrkts commented Aug 9, 2017

Okay, I solved this problem. My new problem is, how to make the size of the square be the width of the screen while also increasing the height to be the same height as the width? When I try self?.picker?.cropSize = CGSize(width: 700, height 700) it does make the picture to be almost the width of the screen, but the height stays the same as it was before I lengthened the width, giving me a long rectangle in the middle of the screen. Thanks for your consideration of this matter.

Sincerely,
Sean

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant