브라우저 용 확장 프로그램을 만들고 로컬 이미지 저장을 원합니다. json 파일에 이미지를 저장하고 싶었습니다. 나는 길을 잃어 버렸어. 아래는 내 코드이지만 나는 꽤 멀리 떨어져 있다고 확신한다. 감사합니다이미지를 Json 파일에 저장
<label>Add New Image From Desktop</label>
<input type="radio" title="Add New Image From Local Machine" name="addMethod" id="radio" />
</br>
<input type="file" id="file-field"/>
<input type="button" id="upload" value="Submit" />
</br>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" language="JavaScript">
$(document).ready(function() {
$("#upload").click(function(data) {
//alert(data);
$.ajax({
type : "POST",
url : "settings.json",
dataType : 'json',
data : {
json : JSONArray.stringify(data) /* convert here only */
}
});
window.location.reload();
});
});
</script>
[자바 스크립트에서 이미지 데이터 가져 오기?] [1]을 (를) 확인해보십시오. [1] : http://stackoverflow.com/questions/934012/get-image-data-in-javascript – Fostah