FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Firebase Storage URL inside img src not rendering base64

opened this issue · comments

Version info

Angular: v1.5.3

Firebase: v3.3.0

AngularFire: 2.0.2

Other (e.g. Node, browser, operating system) (if applicable): Ionic, v1.3.1

Test case

Ionic app captures a photo using cordova camera plugin the base64 string as

function onSuccess(imageData) {
          var image = $document[0].getElementById('my_rcpphoto');
          image.src = "data:image/jpeg;base64," + imageData;
          console.log(image.src);
      }

is uploaded to Firebase storage and its download url is stored in Firebase Database as

$scope.downloadURL = task.snapshot.downloadURL;

While retrieving the URL and injecting into DOM the url rendered as

<img src="https://firebasestorage.googleapis.com/v0/b/project-000000000.appspot.com/o/-KTSzvO-RS6DrvEbfDCR?alt=media&token=00000000-23fd-4dfc-99a4-293643e311c4" alt="" />

Steps to reproduce

Expected behavior

The base64 should be rendered as a graphic and not URL, only after I load the URL in browser i get the file downloaded as base64

Actual behavior

Hey there, thanks for logging the issue. I'm not sure I totally understand what the expected versus actual behavior is though. Can you put together a minimal repro in something like JSFiddle or Plunker which reproduces the issue? Are you using <img ng-src="{dowloadURL}" /> or are you just doing that stuff in the onSuccess() callback you pasted?

I'm a bit confused, but hopefully you can clear up the misunderstanding.

I am using <img ng-src="{dowloadURL}"

like this

<img src="https://firebasestorage.googleapis.com/v0/b/project-000000000.appspot.com/o/-KTSzvO-RS6DrvEbfDCR?alt=media&token=00000000-23fd-4dfc-99a4-293643e311c4" alt="" />

Your example uses src, not ng-src. We will need repro in order to help you out here. Please put one together in JSFiddle or Plunker.

Closing due to inactivity. Let us know if you are still having issues.

Hello,
I want downloadURL as base64 format, so any idea about that please let me know...
$scope.downloadURL = task.snapshot.downloadURL;