PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, July 27, 2022

[FIXED] What is the meaning and how to get the sourceUri and destinationUri in uCrop Library by Yalantis?

 July 27, 2022     android, crop, ucrop, uri     No comments   

Issue

I am creating an Image Cropper Activity. However, my app is not working. I do not know what is the sourceUri and destinationUri means in the builder pattern of the uCrop Library by Yalantis. How can we get or find the sourceUri and destinationUri?

I noticed the contributor in Github said that destinationUri is " where you store the Uri. But how can we get the location to store it? For the sourceUri, I getIntent from another activity to get the imageUri.

I get the imageUri from another activity and I make it as the sourceUri. Please kindly correct me and my mistakes. Thank you very much.

File tempFile = new File (String.valueOf(getIntent().getParcelableExtra("ImageUri")));
File tempCropped = new File(getCacheDir(),"tempImgCropped.png");
Uri sourceUri = Uri.fromFile(tempFile);
Uri destinationUri = Uri.fromFile(tempCropped);


UCrop.of(sourceUri,destinationUri)
    //.withAspectRatio(1,1)
    //.withMaxResultSize(40,40)
      .start(this);

I hope that I can get to know what is the meaning of sourceUri and destinationUri and how to get those Uri.


Solution

How can we get or find the sourceUri and destinationUri?

The sourceUri as you mentionned is retrieved through your Intent's extras, and it represents the PATH to the image that you are working on.

The destinationUri means the PATH where you want to save your cropped image. It can be on the external storage or anywhere you decide to.



Answered By - 113408
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing