I'm trying to display the image in CircularImageView stored in Firebase Storage, but glide gives me this error:
W/Glide: Load failed for gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2 with size [1200x1200]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
The picture is saved in Firestore as:
"gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2"
Binding to image view (uri = "gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB2"):
fun CircularImageView.bindProfilePicture(uri: String?) {
Glide
.with(this)
.load(uri)
.into(this)
}
Dependencies for glide:
implementation 'com.github.bumptech.glide:glide:4.12.0'
No answers in any posts helped me whatsoever. I hope someone could help me. Thanks.
The following URL:
gs://project-2d8i4.appspot.com/pictures/3HnfQSeBladDsD9sPEcKrhxJ6CB
Is indeed a file that is stored in Cloud Storage. Unfortunately, this URL is not recognized by Glide, as it is not a valid URL. To solve the problem you need to get the "download URL" rather than an URL that starts with gs://....
To get the actual download URL, please see the official documentation for:
How to create a reference to a file
And my answer from the following post:
How to get the download url from Firebase Storage?
To avoid cache as mentioned in comments, you can use these two along with glide call.
diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
Check here to use the glide to download from firebase url.
Related
I am building A notes app with firebase. Where users can login and save notes. I want to add a feature where you can store multiple images and users can check it in different devices just with logging in. Like Google notes. I am pretty sure I should firebase Cloud storage for this but cannot figure out a way to do it. Can someone guide me please
Register your app with the Firebase, either from the in-built firebase assistant present in Android Studio or from the firebase website.
For uploading an image, first you have to add the dependency to your app level build.gradle
implementation 'com.google.firebase:firebase-storage:$latest-version
In the activity, add the following to get the reference of the Firebase storage:
FirebaseStorage.getInstance()
Store the reference in an object of type FirebaseStorage.
Later wards on can upload image using the reference variable.
You can read the docs
here
Edit
For uploading multiple images, one can use an Array of URI.
ArrayList<Uri> imageListURI
I am creating and Android app that fetches file url from Parse server and displays the PDF in webView with the help of Google preview, directly loading the PDF into the webView takes forever to load.
But the problem here is Google has a limit of 25mb i.e files larger than 25mb cannot be previewed and it gives a message "Whoops file size too large"
With Google previewer this is how the url looks:
https://docs.google.com/viewer?url=http://my.domain.com/yourPdfUrlHere.pdf
Is there any way to load PDF from URL and also displaying what has already loaded so that the users don't have to wait forever?
Thanks in advance..
webView.loadUrl("http://docs.google.com/gview?embedded=true&url=" + url);
This will concatenate your URL with Google Docs PDF Viewer and load it.
I have been working on utility where I have written java maven and in which I want to upload the file to the firebase and get the firebase URL for image.
Right Now I am using gsutil: Google cloud storage SDK using below code
Storage storage = StorageOptions.getDefaultInstance()
.getService();
Bucket bucket = storage.get(bucketName);
//... code required
return "gs://" + blobId.getBucket() + "/" + blobId.getName();
But above code is giving me gsutil URL which is not usable in HTML img src.
I want firebase URL which can be used in HTML img tag.
In shor I want download URL using Java-Spring code(not android).
The Firebase Admin SDK provides a fairly thin wrapper around the Google Cloud Storage SDK for Java. In Node.js this is accomplished by calling getSignedUrl(), but it seems on Java that you need getMediaLink() as shown in the Cloud Storage documentation.
Also see:
How to download a file from Google Cloud Storage with Java?
Can we use Pinterest API to upload Video ? , because the official documentation show only Post media of type Image .
Thanks .
You can't. But there is a workaround:
First, upload the video to youtube. Copy the thumbnail URL of this newly uploaded youtube video and pin it to Pinterest using the Pinterest API.
For example, if the youtube URL is:
https://www.youtube.com/watch?v=1sqXRQhtqI8
then you can access the thumbnail by the following URL:
http://img.youtube.com/vi/1sqXRQhtqI8/0.jpg
To pin your video on Pinterest, pin the above URL with the Pinterest API.
Following pin is the result of pinning above video.
https://www.pinterest.com/pin/369084131956139919/
There is also a workaround to use animated Gifs - those are supported by using straight image_url parameter :) You can simply convert your video to a gif and post it.
Pinterest has now added support for uploading videos through their api.
Noteworthy is that only business accounts can use this feature.
https://developers.pinterest.com/docs/redoc/martech/#tag/Quick-Start:-Publish-Video
Following this Tutorial to share Image From Assets Folder. Please see previous post i have added code and everything there but the only problem I am facing is I am able to share image via Gmail while failed to share image in case of Bluetooth, Facebook. Can someone please let me know what is the reason ? In case of Bluetooth every time I am getting request but when I send image it response me Fail to Sent
Previous Post