我通過ajax請求發送多個圖像。但是,由於存儲內容,發送多個圖像時出現問題。Ajax發送多個base64圖像
當我嘗試json_decode此對象thumbnailarray。我得到了這個對象
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1048655 bytes)
thumbnailArray = {
image1 : {
image : base64,
rotate : 0,
order : 1
},
image2 : {
image : base64,
rotate : 0,
order : 2
}
}
我送的base64圖像與像圖像旋轉和順序的一些價值觀。 這是代碼:
var formData = new FormData($(this)[0]);
formData.append('ab-user-image', JSON.stringify(thumbnailArray));
$.ajax({
url : baseUrl+'user/ajax_user_add/',
type : 'POST',
data : formData,
async : true,
cache : false,
contentType : false,
processData : false,
success : function(data) {
//success
}
});
有沒有更好的方式來發送的base64圖像或改善這種代碼或東西嗎?
什麼是'thumbnailArray'?你的代碼片段很有用,但是不知道你想要序列化什麼,爲什麼這麼大,你不會得到太多幫助。 –
@TomášHübelbauer我說那是對象。沒關係,我更新後,並添加thumbnailArray,你現在可以看到 –