0

I'm realizing a small app that get an image from server through $resource get action. The purpouse is to manipulate the obtained images and visualize them in the view.

The response from server is a series of character, which I suppose are the image itself. The response header is:

HTTP/1.1 200 OK
Server: nginx/1.0.15
Date: Sat, 07 Feb 2015 15:23:39 GMT
Content-Type: image/jpeg
Transfer-Encoding: chunked
Connection: keep-alive

So:

  1. How can I use this character series in order to get something usable?
  2. Once this is done, which js library I can utilize to edit this image?

Thanks

Nemus
  • 1,322
  • 2
  • 23
  • 47

1 Answers1

0

You might try looking at this post to see how to set the source of an image element with a base 64 string.

A better idea is probably to use the data to load an image into a canvas element. From there you can use any number of libraries to manipulate the image. Perhaps something like this (I don't have any experience with Fabric, it just looked like a good example).

Community
  • 1
  • 1
HeadCode
  • 2,770
  • 1
  • 14
  • 26
  • thx. my base64 image contains a lot of '�' character. How can I manage them? – Nemus Feb 08 '15 at 11:39
  • @Nemus Hm, base 64 should only contain printable characters. It doesn't sound as though your string is really base 64. – HeadCode Feb 08 '15 at 17:47
  • Also, why bother with Angular? If you look at the canvas tutorial I linked to above you can create a canvas element and directly load the image data from a URL. – HeadCode Feb 08 '15 at 18:02
  • Didactic purpose: I want to learn how to get an image via Angularjs services. Why I can get an image through web browser but not through services? How server response to my image request? – Nemus Feb 08 '15 at 18:10