在angularjs中将图像转换为base64 [英] convert image to base64 in angularjs

查看:59
本文介绍了在angularjs中将图像转换为base64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,用户将上传他们的图像,我必须将其转换为某些内容并将其发送到 .Net RESTful 服务.我是 angular js 的新手.有人可以帮忙吗

I have a requirement where user will upload their image and i have to convert it into something and send it to .Net REStful service. I am new to angular js. Could someone please help

推荐答案

从这里回答 https://stackoverflow.com/a/24880314/625189

我建议你使用https://github.com/ninjatronic/angular-base64.

按照使用此库的说明后,您可以简单地调用:

After following instructions for using this library, you can simply call:

var imageData=$base64.encode(image);

不要忘记注入你的模块:

Don't forget to inject in your module:

.module('myApp', ['base64'])

这篇关于在angularjs中将图像转换为base64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆