Skip to content

Instantly share code, notes, and snippets.

@metalmatze
Created March 4, 2015 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metalmatze/b02ad7979baff82adb60 to your computer and use it in GitHub Desktop.
Save metalmatze/b02ad7979baff82adb60 to your computer and use it in GitHub Desktop.
GET image and display base64
$http.get(url, {
headers:
Authorization: 'Bearer ' + authenticationService.getToken()
responseType: 'arraybuffer'
})
.success((data) ->
image = new Image()
reader = new FileReader()
blob = new Blob([data])
reader.onloadend = ->
image.src = reader.result
reader.readAsDataURL(blob)
element.append(image)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment