删除Blob中的Localhost URL

时间:2015-08-13 10:55:31

标签: javascript canvas blob

你是画布的新手!!!

var blob = new Blob([uint8Array], { type: "image/png" });
$rootScope.blobVal = URL.createObjectURL(blob);

我使用上面的代码将Canvas DataUrl转换为Blob对象从上面的代码片段获取 blobval 作为URL

  

团块:HTTP%3A // xyz.xyz.x.yz%3A8100 /   4fa503b3-2e1d-4d38-b112-1f417c670b93

但我只需要

  

4fa503b3-2e1d-4d38-b112-1f417c670b93

先谢谢!!

1 个答案:

答案 0 :(得分:3)

var blob = new Blob([uint8Array], { type: "image/png" });
var objectUrl = URL.createObjectURL(blob);
str_arr = objectUrl.split("/");
$rootScope.blobVal = str_arr[str_arr.length - 1];

$ rootScope.blobVal包含4fa503b3-2e1d-4d38-b112-1f417c670b93