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'
Related
I'm working with a tutorial fromRay Wenderlich (https://www.raywenderlich.com/124438/android-listview-tutorial). In the tutorial, an image is retrieved via the Internet using a URL specified in the locally stored JSON file:
"image" : "https://www.edamam.com/web-img/341/3417c234dadb687c0d3a45345e86bff4.jpg"
The string is stored in the imageUrl variable:
recipe.imageUrl = recipes.getJSONObject(i).getString("image");
Then the image is loaded using Picasso:
Picasso.with(mContext).load(recipe.imageUrl).placeholder(R.mipmap
.ic_launcher).into(thumbnailImageView);
I would like to change the code in the tutorial so that the image is retrieved from the drawable folder within the app, rather than via the Internet. I've been working on this on and off for several days. I assumed it was a matter of changing the URL in the JSON data so that it specified a path to the image file in the drawable folder like this:
"image" : "android.resource://com.raywenderlich.alltherecipes/drawable/chicken.jpg"
So far I've been unsuccessful. Am I on the right path, or am I way off? I'm an Android newbie. I'm used to working with plists in Xcode (although I'm no expert there, either).
I am using Aviary, but when i open any image in Aviary then it creates an cache image path.
I am passing my own image path but still it creates their new path (WITH CACHE IMAGE).
Any suggestions on this.
Thanks in Advance.
The Creative SDK Image Editor (formerly Aviary) will do this if you use an http Uri as the location of your original image when you call .setData().
As noted in the Methods section of the Creative SDK Image Editor guide, for the .setData() method:
.setData()
Sets the input image Uri.
Supported schemes are:
scheme_file (e.g. file://mnt/sdcard/download/image.jpg)
scheme_content (e.g. content://media/external/images/media/112232)
Note: http will work for low-resolution editing only, but it is not a feature that we currently support.
Part of http Uri's not being a supported is that the saved image is lower quality and the output Uri is set by the Image Editor.
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.
I am trying to open email activity and to display in the email's body the following:
Display a hyperlink to a web site.
Display (not attach) an image logo (.png file).
I tried using html/text/image mime type and nothing works for both things.
I even tried to copy the png file to an sdcard and displaying it from sdcard path instead of using the "Assets" location that may be restricted and private only to the application, but it did not help as well!
Can anyone give me a code which works for both things??
Waiting for you help guys!!
Have you tried :
Linkify.addLinks(yourEmailString, Linkify.WEB_URLS);
yourTextView.setMovementMethod(LinkMovementMethod.getInstance());
It will make all links in the message clickable, not sure if this is what you are searching though :)?
I'm trying to retrieve the currently-logged-in user's avatar image so that I can save it on my server and use it later in my application.
How would I go about getting the image directly?
Try this:
(replace USER_ID with alias or user ID...)
set source as https://graph.facebook.com/USER_ID/picture
for example large icon of a Page ID 149926629437 is:
http://graph.facebook.com/149926629437/picture?type=large
<img src="http://graph.facebook.com/149926629437/picture?type=large"/>
more info (specify size etc...):
http://developers.facebook.com/docs/reference/api/
part Pictures
(I also userd the aQuery (android query) to cache images...
aq.id( holder.image).image("https://graph.facebook.com/" + USER_ID + "/picture?type=normal");
http://code.google.com/p/android-query/
It seems working fine...
)
Can't say much about this, but you might want to try the facebook android sdk here ->https://github.com/facebook/facebook-android-sdk . Good luck :)
If you want a higher quality profile picture try:
https://graph.facebook.com/{ID}?fields=picture.height(2048)
And then retrieve the response.picture.data.url