Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Pick image and video from device gallery

Discussion in 'Assets and Asset Store' started by DeveshPandey, Feb 11, 2015.

  1. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212
    Image and Video Picker is for Android and IOS, this plugin is very useful for developers who are developing applications or games for Android/IOS in unity. Using this plugin you can pick images, video from the gallery.






    Features :
    - Pick image from gallery.
    - Use picked images as textures in Unity.
    - Crop picked image and use in unity.
    - Get image rotation from EXIF data with picked image.
    - Browse Video from gallery and get path to video in Unity for your use.
    - No need to worry about native code
    - Easy to integration
    - Easy to use
    - Fully documented
    - Full support

    Included Files:
    - Integration Guide
    - Documentation
    - Example Scene
    - AndroidManifest.xml

    Assets Store : https://www.assetstore.unity3d.com/#!/content/28597?aid=1101l34jr

    For any query please drop me an email at devesh.pandey19@gmail.com .
    Facebook : https://www.facebook.com/unity3ddeveloper

    Blog : http://unitydevelopers.blogspot.in/p/blog-page_13.html
     
    Last edited: Jan 10, 2018
  2. masteryder

    masteryder

    Joined:
    Aug 15, 2016
    Posts:
    5
    I've used the demo apk, and it left me with one question, is it possible to not rotate pictures 90 degrees when cropping them?
     
  3. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212
    No, this feature is not there in the plugin, you have to rotate it by yourself.
     
  4. zazaye

    zazaye

    Joined:
    May 9, 2017
    Posts:
    1
    Hello,

    Thanks for your plugin.
    But i met a problem when using it .
    When i run the example in ipad,click the browse [Browse Image] button,it was crashed in ipad.

    Could you tell me some possible reasons?

    Thanks.
     
  5. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212
  6. Saddamjit_Singh

    Saddamjit_Singh

    Joined:
    Dec 4, 2015
    Posts:
    22
    Hi , i am using "ImageAndVideoPicker" plugin and i am getting some issues. I am mailing you at "devesh.pandey19@gmail.com" for last two days with no reply. I need help with Image orientation . Whenever i am selecting a large sized pic , it automatically gets rotated in left or right direction. Please tell me how to fix it.
     
  7. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212

    Hello,

    Sorry for delay in response because I was out of station for few days.

    I replied you on email with the suggested solution for your problem, follow those steps and let me know if you want any other help from me.
     
  8. kaursandeep

    kaursandeep

    Joined:
    Feb 2, 2017
    Posts:
    7
    Hello Sir,

    I am getting an issue while running the code during the browseAndcrop image button click. The screenshot is attached below:
    Screenshot_2017-12-26-14-44-07.png

    Kindly give your suggestions to resolve this issue. Hope you revert me soon!

    Thanks
    Sandeep Kaur
     
  9. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212
    Hello,

    This will happen if plugin is not properly imported or deleted some files accidentally or if you are not testing on actual android device.

    So please write me at devesh.pandey19@gmail.com with steps to reproduce, I will try to solve it asap.
     
  10. kaursandeep

    kaursandeep

    Joined:
    Feb 2, 2017
    Posts:
    7
    Hello Sir,

    Thank you for your response.I reimport the plugin and everything works fine. Unfortunately, the image orientation is not working fine.Whenever i select a large sized image (that is clicked in portrait mode) , it automatically gets rotated in left or right direction, but if image is clicked in landscape mode it works fine.Please tell me how to fix this issue.I also send you mail at "devesh.pandey19@gmail.com" on 5 jan(Friday),but i get no reply. I need your help with Image orientation.

    Thanks
    Sandeep Kaur
     
  11. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212

    Hello Sandeep,

    Your email was in spam therefore I missed it. Sorry for that.

    You will get image rotation with each picked image, then you can rotate it in original position or as you want.

    Here are some useful steps to rotate image
    1). You have to rotate texture by yourself by using image rotation received with picked image, so search code for rotating texture in unity.
    2). Don't subscribe OnImageLoad function, only subscribe OnImageSelect
    3). You will get path of the picked image with image orientation in OnImageSelect function, load texture from the path to your texture.
    Texture2D texture = new Texture2D(8,8);
    texture.LoadImage(System.IO.File.ReadAllBytes(imgPath));
    5). Rotate the received texture by using image rotation.

    Note : OnImageLoad will give you non-readable texture therefore you will not be able to modify it, this is done to prevent memory leaks on iOS. If you want to modify the texture then use steps mentioned above.
     
  12. DeveshPandey

    DeveshPandey

    Joined:
    Sep 30, 2012
    Posts:
    212
    Dear users of ImageAndVideoPicker plugin, I am getting many request of the same issue like

    Error:-
    myappname[1345:476415] [discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={
    NSLocalizedDescription=query cancelled}


    Cause:-

    I figured out that many users trying to modify/readbytes/readpixels of the received texture in OnImageLoad, which is not permissible due to memory issues in iOS. Texture (tex) received in OnImageLoad is only for displaying somewhere for preview, because its non-readable texture so you can't read the pixels of this texture.

    Solution :-

    1). Don't subscribe OnImageLoad function, only subscribe OnImageSelect
    2). You will get path of the picked image with image orientation in OnImageSelect function, load texture from the path to your texture.
    Texture2D texture = new Texture2D(8,8);
    texture.LoadImage(System.IO.File.ReadAllBytes(imgPath));

    then modify your texture as you want.
     
    Braza likes this.
  13. kaursandeep

    kaursandeep

    Joined:
    Feb 2, 2017
    Posts:
    7
    Hello Sir,

    I am using "ImageAndVideoPicker" and facing many problems.The orientation was not correct in the Android and you send me updated .Jar file, after replacing this file the orientation is fine in android.But, now I am facing same problem in iPhone as well as in iPad. I am attaching the screenshots along with this message for your clarification.Kindly provide the appropriate solution.Moreover, I am surprised why the crop box does not appear in iPad as I tested on below two iOS versions and devices but appears fine on iPhone on every iOS versions(as I tested on 4-5 different devices with different iOS versions).

    1. iPad mini having iOS 10.0.2
    2. iPad 3 having iOS 9.3.5

    If anyone else faced the same problem and have some solution, kindly share with me.
    Hope you revert soon with appropriate solution.

    Thanks
    Sandeep Kaur
     

    Attached Files:

  14. rinkusaru

    rinkusaru

    Joined:
    Sep 7, 2017
    Posts:
    14
    Is it possible to get the texture if I give the path of image instead of showing the native gallery and select from there.
    For example I've list of path in my device where I know the image exist so if i pass the path to your plugin will it give me the texture.
    I know i can do that with www or file.readallbyte but I'm facing the cache issue and application stuck whenever i try to do that.
     
  15. SplashFoxGames

    SplashFoxGames

    Joined:
    Oct 10, 2012
    Posts:
    47
    Can't launch an android app using the lib and latest Unity 2018 (v3 I believe) : (
    Had issues with prev. when using Gradle build. Anyone experience something like that?
     
unityunity