在我的Nativescript应用程序中,我希望使用相机模块捕获图像,然后通过http调用将字节直接发送到服务器。
以下是我的代码(为简洁起见,不完整):
var cameraModule = require("camera");
var http = require("http");
...
cameraModule.takePicture().then(function (img) {
// how to extract the actual bytes from img???
http.request({
url: some_u
我有本地图像URL,我想从它获得blob。
我发现的唯一方法是在本地URL上执行HTTP请求'get‘,然后读取返回的blob……但这是一种很奇怪的方式。
使用HTTP的代码片段:
function readBody(xhr) {
var data;
if (!xhr.responseType || xhr.responseType === "text") {
data = xhr.responseText;
} else if (xhr.responseType === "document") {
在网页视图的html中将imageview.toImage()设置为img src的想法。
假设我有一个图像视图(其中包含一些图像),.okay imageview.toimage()被视为钛合金图像对象。现在我需要的是我想要设置
webview.html='<html><img src="here i want to put obove imageview.toimage()"></html>';
我尝试了很多方法,有经验的人请指导我。
致敬:ali