我目前正尝试使用JavaScript或任何可以集成到Chrome扩展的目录中的自动过程下载图像到目录中的特定文件夹,以便它可以由另一个程序处理。从一个网站使用javascript下载图像客户端到硬盘驱动器
目标:我附加的图像有我试图下载的图像标记的突出显示部分,但到目前为止,我只找到一种方法将它下载到本地存储中作为测试。
这是我目前用于测试的代码,以查看是否可以将其定位到本地存储中。
// Get a reference to the image element
var captchaImg = document.getElementById("captchaImg");
// Take action when the image has loaded
captchaImg.addEventListener("load", function() {
var imgCanvas = document.createElement("canvas"),
imgContext = imgCanvas.getContext("2d");
// Make sure canvas is as big as the picture
imgCanvas.width = captchaImg.width;
imgCanvas.height = captchaImg.height;
// Draw image into canvas element
imgContext.drawImage(captchaImg, 0, 0, captchaImg.width, captchaImg.height);
// Get canvas contents as a data URL
var imgAsDataURL = imgCanvas.toDataURL("image/png");
// Save image into localStorage
try {
localStorage.setItem("captchaImg", imgAsDataURL);
}
catch (e) {
console.log("Storage failed: " + e);
}
}, false);
我对Chrome扩展计划过于写清单和所有其余一旦我知道什么是从用于下载和处理图像的最终剧本需要和这样的权限。
目标:
下载图像到硬盘驱动器
下载图像到特定文件夹
有下载自动
的代码在Chrome中执行分机号
可以使用'应用程序/八位字节steam''MIME'型图像下载到硬盘驱动器。不确定“自动化”的含义?您是否正在尝试将文件写入或下载到客户端文件系统的特定文件夹? – guest271314
尝试下载到客户端文件系统上的特定文件夹,如窗口中的图片文件夹,并在页面像上述事件侦听器一样加载时自动进行自动化。如果它有效,我将不得不寻找八卦蒸汽的东西,你可以把它作为答案,所以我可以给你信贷和代表帮助? – BlakeAyrl
请参阅http://stackoverflow.com/questions/37106121/jquery-file-upload-plugin-is-possible-to-preserve-the-structure-of-uploaded-fol,http:// stackoverflow。com/questions/33951243/onclick-of-anchor-download-document-in-same-window,https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/filesystem-access – guest271314