Download image from new Google+ (plus) Photos Of Gallery with Image Extension - android

In new android version, they have added gplus photo section in gallery.
In my application, i have incorporated the logic of selecting image from it and display to the user using below link of stackoverflow:
Download image from new Google+ (plus) Photos Application
However, i also need image extension as we are sending image raw data with extension of selected picture to the API. gplus returns the image path like this
content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%<a bunch of letters and numbers here>
So, how can i get extension of that image also from gplus?? Any idea??
I AM SUCCESSFULLY GETTING BITMAP FROM ABOVE URI. I JUST NEED EXTENSION OF THAT IMAGE NOW.
Thanks.

Use ContentResolver.getType(uri):
Uri uri = // your content://com.google.android.apps.photos.content URI
String mimeType = getContentResolver().getType(uri);
// mimeType will be image/png, image/jpeg, etc.

Related

Android convert multipart MultiBodyPart.Part into imageuri or bitmap

I have a method that returns selected images from the camera or gallery path to MultiBodyPart.Part to be sent to API which is working fine, but at the same time, I need to use this MultiBodyPart.Part and show this in the imageview.
What I am looking for is how can I use MultiBodyPart response to show in my imageview.

Android - How to determine if slected image is panorama? [duplicate]

I need to show all panorama photo in Gallery android. But it extension is jpg same regular photo.
How can I check a photo in Gallery android is Panorama photo?
Thanks
You'll need to extract the XMP Metadata
XMP Metadata is essentically image metadata...
...encoded in some XML-friendly format, such as Base64.
See this previous question/answers on StackOverflow to see how to decode Base64.
Based on the xml you can decode from the jpeg, you may be able to guess the intent-filter you'll need. In the case of a photo sphere panorama format for instance, this is the format.
If you want to accept Photo Sphere images in your own Android apps,
you can add the custom MIME type
application/vnd.google.panorama360+jpg to the relevant IntentFilter in
your app.
However, I'm not sure what type of panorama your jpeg is in. It may help if you posted the particular jpeg with your question.
Ask the mediadatabase through a filter condition
Where ((height/width > 2) or (width/height >= 2))
something like this
ContentResolver resolver = context.getContentResolver();
Cursor query = resolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
sqlSelectColums, '((height/width > 2) or (width/height >= 2))',
null, sqlSortOrder);

how can check panorama photo android?

I need to show all panorama photo in Gallery android. But it extension is jpg same regular photo.
How can I check a photo in Gallery android is Panorama photo?
Thanks
You'll need to extract the XMP Metadata
XMP Metadata is essentically image metadata...
...encoded in some XML-friendly format, such as Base64.
See this previous question/answers on StackOverflow to see how to decode Base64.
Based on the xml you can decode from the jpeg, you may be able to guess the intent-filter you'll need. In the case of a photo sphere panorama format for instance, this is the format.
If you want to accept Photo Sphere images in your own Android apps,
you can add the custom MIME type
application/vnd.google.panorama360+jpg to the relevant IntentFilter in
your app.
However, I'm not sure what type of panorama your jpeg is in. It may help if you posted the particular jpeg with your question.
Ask the mediadatabase through a filter condition
Where ((height/width > 2) or (width/height >= 2))
something like this
ContentResolver resolver = context.getContentResolver();
Cursor query = resolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
sqlSelectColums, '((height/width > 2) or (width/height >= 2))',
null, sqlSortOrder);

Can't share image from dataDirectory via SocialSharing-PhoneGap-Plugin

I have a Cordova android project and using SocialSharing-PhoneGap-Plugin to share images
I'm storing images in dataDirectory. But when sharing image, it won't shares!
window.plugins.socialsharing.share('', 'subject', window.cordova.file.dataDirectory + 'folder/image.jpg');
Share popup appears and I can select an app, subject will share but image won't!
If I share an image from www folder, it works fine.
I used share with image data method:
window.plugins.socialsharing.share(null, 'Android filename', 'data:image/png;base64,R0lGODlhDAAMALMBAP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUKAAEALAAAAAAMAAwAQAQZMMhJK7iY4p3nlZ8XgmNlnibXdVqolmhcRQA7', null);
Note: passing a base64 file as 'data:' is not supported on Android 2.x
You can see here how to Get base64 image data
I'm adding files/ in the final path and it works for me:
window.cordova.file.dataDirectory + 'files/folder/image.jpg'

Load the images from the Gallery into gridview

This LazyLoading library helps me to load the images from the internet. Can i use this library to load the images from the gallery.
imageLoader.DisplayImage(url, image);
What should i send the argurment to display the image from the gallery
Note I'm having the path of the images in the ArrayList
Imp Note : I'm also having the ArrayList of byteArray (one byte array resembles to one image). So then how can i use the library
Edit I encrypted some images from the gallery and stored in SDCard and i need to display the encrypted images in my app(I know the path of the encrypted images) Encryption is done in Byte[] level.
Please suggest me. ThankYou
Can i use this library to load the images from the gallery?
Gallery itself a application which is showing images from your local folder. So if you have a local image you can show it by its path in your App.
You just need to add file in your image path to make path as URI.
Like
String URL = "file:///mnt/sdcard/image.png"; // from SD card

Categories

Resources