【问题标题】:Download image from new Google+ (plus) Photos Of Gallery with Image Extension从带有图片扩展名的新 Google+(加)图库照片下载图片
【发布时间】:2014-02-20 06:25:34
【问题描述】:

在新的 android 版本中,他们在图库中添加了 gplus 照片部分。

在我的应用程序中,我已经合并了从中选择图像并使用以下 stackoverflow 链接显示给用户的逻辑:

Download image from new Google+ (plus) Photos Application

但是,我还需要图像扩展,因为我们将带有所选图片扩展的图像原始数据发送到 API。 gplus 像这样返回图像路径

content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh5.googleusercontent.com%<a bunch of letters and numbers here>

那么,我怎样才能从 gplus 获得该图像的扩展名?有什么想法吗??

我已成功从 URI 上获取位图。我现在只需要扩展该图像。

谢谢。

【问题讨论】:

    标签: android google-plus


    【解决方案1】:

    使用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.
    

    【讨论】:

    • 非常感谢@ianhanniballake。让我试试并尽快更新你。 :)
    • 非常感谢。有效。让我接受这个答案。 :)
    猜你喜欢
    • 2017-09-03
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-16
    • 2016-06-08
    相关资源
    最近更新 更多