HTML BLOB 오브젝트 또는 HTML File 오브젝트를 이용하여 이미지를 표현한다.
Parameters | Type | Description |
---|---|---|
objBloborFileObject | INSTANCE | HTML BLOB 오브젝트 또는 HTML File 오브젝트 |
nDisplayImageWidth | long | [옵션] 표시될 이미지 너비 |
nDisplayImageHeight | long | [옵션] 표시될 이미지 높이 |
Type | Description |
---|---|
BOOL | 성공/실패 여부 |
setimageobject API는 비동기로 동작하며, 이미지 로드 완료이 이미지 컴포넌트의 on_load 이벤트가 발생한다.
function btn_on_mouseup(objInst)
{
var file_object;
// 파일 업로더 컴포넌트의 HTML File 오브젝트를 구함
file_object = file_upload.getfileobject(0);
if (file_object) {
// HTML File 오브젝트를 이용하여 이미지 로드
// 이미지 로드 완료시 on_load 이벤트가 발생함
img.setimageobject(file_object);
}
}
function img_on_load(objInst, nImageWidth, nImageHeight) {
var blob_object, file_object;
// 이미지 컴포넌트의 Data URL을 구함
data_url = img.getimagedataurl();
blob_object = img.getimageblobobject(data_url);
if (blob_object) {
screen.alert("Size = " + blob_object.size + ", Type = " + blob_object.type);
}
else {
screen.alert("getimageblobobject Fail");
}
file_object = img.getimagefileobject(data_url, "myimage.png");
if (file_object) {
screen.alert("Size = " + file_object.size + ", Name = " + file_object.name);
}
else {
screen.alert("getimagefileobject Fail");
}
}