我目前正嘗試使用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