即時通訊工作在mobilefirst適配器(6.3)需要從internarl網絡文件系統(例如:http://www.up.edu.pe/RED_Compartir/facebook.png)中的URL傳遞圖像,但我無法正確獲取數據在文本變量的IMG數據的心不是: 這裏是我的服務器端代碼:從mobilefirst http適配器獲取jpg圖像
function getImage(id){
var input = {
method : 'get',
returnedContentType : 'plain',
path : '/someUrl/someUrl2/'+id+'.jpg'
};
return {
out: Base64.encode(WL.Server.invokeHttp(input).text)
};
}
這裏是我的客戶端代碼來處理德圖像:
function getImageFrom() {
execMobileFirstAdapter("adapterName", "method", ["parameter"]).then(function (data){
WL.Logger.debug("OK")
var imageBase = data.invocationResult.out;
document.getElementById('imageServer').setAttribute('src', 'data:image/jpeg;base64,'+ imageBase);
}).fail(function(data){
WL.Logger.debug("error");
})
}
有沒有辦法返回的base64從一個mobilefirst適配器的JPG圖像?
和完美的作品,但我需要在服務器只用JavaScript來做到這一點。這是可能的嗎?
您需要更好地解釋端到端的情況。這幅圖像在哪裏?在一個網頁?在數據庫中?在文件系統中?你要去哪裏?進入一個應用程序,顯示它?提供資料。而且,這還不夠代碼。同時添加客戶端代碼以及適配器XML。 –
ty,我只是添加更多的代碼,一些信息和一個適用於我的示例 – user2449016