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

Add Option to crop image and use edited image. #36

Merged
merged 3 commits into from
Feb 7, 2018

Conversation

joaodforce
Copy link
Contributor

I was implementing ImageRow into my project and noticed there was no way to use the editor.

I Mean, the snippet bellow allowed me to show the editor after my selection.

row.onPresent({ (Forms, Picker) in Picker.allowsEditing = true })

However there was no way to use the edited Photo, or to get access to the EditInformation, because it is not possible to change de delegate on the onPresent callback.

So my solution was add 2 properties, allowEditor and useEditedImage.
Both are default to false

The former if set to true shows the editor after a Image Selection.
The ladder switches the property get from the callback to use the Cropped Image instead of the original.

I Also added a property called userPickerInfo, which stores The Edit information, that cannot be accessed otherwise.

I was also thinking about adding some options to customize the UIImagePickerController even further, but this is enough for now.

… it to quick implementation of a cropped image by the standard image editor.

Also Added the userPickerInfo [String : Any]? property that stores the result of the User edit.

All of that keeping the standard functionality.
@mats-claassen
Copy link
Member

Looks good. Could you add these new properties to the ReadMe under Customization?

@joaodforce
Copy link
Contributor Author

Sure, i have just pushed the changes.

@mats-claassen mats-claassen merged commit 80587a6 into EurekaCommunity:master Feb 7, 2018
@funkenstrahlen
Copy link
Contributor

@joaodforce Thanks for adding this functionality! I really like it!

@mats-claassen Could you create a new release containing this PR?

@axiom-media
Copy link

I added ImageRow to my CocoaPods Podfile and installed. It says it is using version 3.0.0 but I am not seeing any references to the new properties that allow image editing. Is there a trick to get CocoaPods to download the latest and greatest version which includes this enhancement?

@funkenstrahlen
Copy link
Contributor

If it says it installed 3.0 it did. Maybe you need to need to clean your Xcode Build folder and rebuild.

@axiom-media
Copy link

After trying a bunch of things (including reinstalling cocoapods) I was able to get the latest version by adding this to my Podfile instead of just pod 'ImageRow' so perhaps there is some issue with cocoapods?

pod 'ImageRow', :git => 'https://github.com/EurekaCommunity/ImageRow'

@funkenstrahlen
Copy link
Contributor

Take a look at the commit history. There is no cocoa pods release containing this PR yet. Release of 3.0.0 was before this got merged.

@joaodforce
Copy link
Contributor Author

@axiom-media as @funkenstrahlen said, there was no PR for this update, so for cocoapods there were no changes to this repository, so to get this you would have to clear your pods repository cache, then reinstall it.

@martheli
Copy link

martheli commented Jun 1, 2018

I added the below to my image row:

$0.allowEditor = true
$0.useEditedImage = true

but when I take picture from the row, the editing toolbars do not show up. Is this related to the above issue with cocoa pods version? I am using imagerow version 3.1.0.

@joaodforce
Copy link
Contributor Author

Bellow is an example of how I use it in my code, you should check your ImageRow version, try cleaning you pods cache and reinstalling it, if it still doesn't work you should probably open an Issue.

image

@axiom-media
Copy link

When I set both row.allowEditor and row.useEditedImage to true I get the crop UI after taking a photo with the camera on my iPhone 7 Plus but the behaviour is quite strange. I can zoom and pan the image within the crop square, but I can't move the photo all the way to the top or bottom. It seems to have an arbitrary boundary that it won't let me pan beyond. Is this the expected behaviour or some sort of bug?

@joaodforce
Copy link
Contributor Author

This is the behavior of the default iOS system cropper, I find it weird too, but it is easier to use it than to make one yourself, besides on iOS 12 it looks like it will be revamped.
If the system one does not supply your needs you would have to implement your own image cropper.

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

Successfully merging this pull request may close these issues.

5 participants