How to resize an image before uploading it via Swift’s webView?

We have a website built with JQueryMobile, which is displayed to our users through a phone application.

One of the pages is composed of a fileChooser, with which the user chooses the image from the device and then a button that has the task of uploading the photo to our server.

The image must be resized before loading.

 

Android side in the onActivityResult method, we capture the moment and resize the image correctly.

 

Android

@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  if (requestCode==FILECHOOSER_RESULTCODE)
  {
  //Resize image
  }
}

 

In Swift how do I capture that moment to resize the image and then load it?

Summing up:

  • I enter the page (it works)
  • I click on the button to choose img (HTML tag input type = “file”) (it works)
  • I select image (it works)
  • Resize image (to be developed)
  • Image upload (works)

 

Searching the internet I found the code to resize the image.

In Swift what is the method corresponding to Android’s onActivityResult?

 

I hope I have been clear enough

Powered by WPeMatico

About

You may also like...

Comments are closed.