imagekit-ios icon indicating copy to clipboard operation
imagekit-ios copied to clipboard

Widget for Image Upload

Open ahnv opened this issue 5 years ago • 9 comments

The Image Upload widget should offer the user an interactive user interface that enables the user to edit and upload files to ImageKit Media Library. The proposed widget should integrate with just a couple of lines of code, eliminating the need to develop certain interactive media upload capabilities.

Additional Functionality that can be added is to allow cropping and rotation of the image before uploading.

ahnv avatar Oct 01 '20 13:10 ahnv

Hi @ahnv, I am interested in supporting this feature. Can you elaborate more on the feature? Thanks

jadhavp avatar Oct 02 '20 14:10 jadhavp

Hey @jadhavp, Thanks a lot for showing interest in taking up this feature. Basically this feature would help the user to add a UI element that will have an internal implementation of UIImagePickerController (which does have cropping functionality inbuilt, but we would like to extend it to crop and rotate for now) and it will upload the image directly. The developer should be able to integrate this feature into his own app by just a couple of lines and adding UI Element to the storyboard.

For instance, It can be like an upload area, the user clicks on it, UIImagePicker opens and user selects the image. Once the selection is done, the image can be cropped and rotated before it is uploaded. The upload of image should also be handled internally by wrapping the uploader() method. Improvements and suggestions are always welcome.

If you have any feature idea, feel free to contact me or create an issue on the repo itself.

ahnv avatar Oct 02 '20 17:10 ahnv

Custom UIView , Suggested names

  • ImageKitWidgetView
  • IKWidgetView
  • IKImageView
  • ImageKitView

Let's Keep it as UI view subclass, It gives flexbility for future additions. This view/widget will have below APIs, Action & features

  • API
    • setPIaceholderImage - Sets placeholder image of control
    • setShowUploadProgress - Default true, toggle activity indicator for upload progress
    • setCompletionBlock: block which notifies about success, failure,cancel of flow
    • updateImageOnUpload: Default false, toggle control image to uploaded image automatically if set to true
    • image (getter): gets uploaded image
  • Actions
    • Onclick/Tap - flow
      • Control shows Camera or photos library to select an image
      • User selects the image
      • Edits the image (Optional)
      • Submit/Done
      • IKIOView starts uploading internally, show small indicator indicator
      • Notifies result using - block if available, set by setCompletionBlock API
  • Availbale in interface builder

Code integration (Pseudocode)

let ikioView = IKIOView();
addSubview(ikioView)

By default It can have Upload text, standard size 90x30, adjustable by adding constraints.

Let me know your suggestions.

I tried Example App in this repo, it is failing to upload image. It may be due localhost endpoint authenticationEndpoint: "http://localhost:8080/auth" if possible please let me know how I can check upload at my end any test pub/private key I can use ?

Thanks.

jadhavp avatar Oct 03 '20 07:10 jadhavp

The proposed implement looks good, similar to what we had in mind. It would be called IKUpload and IKImageUpload to keep consistency with naming done in other SDKs.

We would be providing the same for other files as well that are supported, later on. The whole list can be found here

So finally, we will have IKUpload that can handle all files and IKImageUpload that can be specific to just images. For other file types, it will be just an upload box with an activity indicator for upload without the image-specific features and for thumbnail, it can return a file icon similar to https://github.com/imagekit-developer/imagekit-ios/blob/22c27c25f30dcb3a12b551a2b5216fc5aad001e4/Example/ImageKit/UploadFileViewController.swift#L83-L87

It would be better if it is made on the lines of the final implementation.

Regarding the example app, you can directly sign up at ImageKit.io. We offer a forever free plan for the community.

Also, as this feature is for uploading images, we are working on decoupling AlamoFire as a dependency from the SDK, you can find the code for the same here

ahnv avatar Oct 03 '20 18:10 ahnv

@ahnv based on available time, I can work on the below items for IKImageView

  • [ ] Image Editing - Crop & rotate
  • [ ] Default Placeholder
  • [ ] Loading Activity Indicator
  • [ ] Completion block for notifying Upload status

I guess, the base branch to be used is - https://github.com/imagekit-developer/imagekit-ios/tree/native-http, right?

Thanks, Let me know if you want me to proceed.

jadhavp avatar Oct 05 '20 14:10 jadhavp

Sounds great, I was just putting out the complete plan we have in mind. For the start, these features sound good for the time being. Yes, we can start working on native-http branch itself.

I'll assign you the Issue, you can start working on it. Best of luck

Feel free to contact me for any clarifications.

ahnv avatar Oct 05 '20 14:10 ahnv

Cool, thanks. I Will let you know if anything else needed.

jadhavp avatar Oct 07 '20 04:10 jadhavp

@jadhavp Any update?

ahnv avatar Oct 25 '20 12:10 ahnv

hey @ahnv sorry buddy, due to some personal issues I could not spend time on this, Apologies for delayed response. If anyone else is available, please reassign the issue, not sure about my availability.

jadhavp avatar Oct 31 '20 11:10 jadhavp