Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot download image/video from firebase storage #66

Closed
alihaider78222 opened this issue Aug 5, 2020 · 3 comments
Closed

Cannot download image/video from firebase storage #66

alihaider78222 opened this issue Aug 5, 2020 · 3 comments

Comments

@alihaider78222
Copy link

Here is an example of image link i tried to download and its generating error on this similar links "https://firebasestorage.googleapis.com/v0/b/eventat-4ba96.appspot.com/o/2019-Metrology-Events.jpg?alt=media&token=bfc47032-5173-4b3f-86bb-9659f46b362a"

@benlove
Copy link

benlove commented Aug 15, 2020

This is an easy one to fix, but I can't figure out how to do a pull request. in lib/files.dart the isVideo and isImage functions use the extension method and this doesn't recognize extensions that are inline in the URL string. The quickest way to fix this is by removing the existing isVideo and isFile functions in lib/files.dart and replace them with:

bool isVideo(String path) {
  bool output = false;
  videoFormats.forEach((videoFormat) {
    if (path.toLowerCase().contains(videoFormat)) output = true;
  });
  return output;
}

bool isImage(String path) {
  bool output = false;
  imageFormats.forEach((imageFormat) {
    if (path.toLowerCase().contains(imageFormat)) output = true;
  });
  return output;
}

@alihaider78222
Copy link
Author

i'll try this solution, thanks for you help, i really appreciate that :) 👍

@ismailgungor
Copy link

ismailgungor commented Aug 25, 2020

Hi, I fix it by adding ".png" or ".jpg" to end of the firebase url.
Here you can see the example:
var currentUrl = "${viewModel.currentWallpaper.url}.png";
GallerySaver.saveImage(currentUrl);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants