I wrote the following code, but I can't see the image. Why?
The image is in Google Photo under My Drive
Code .gs side
function getPic(idStr){
varfile=DriveApp.getFileById(idStr);
varimTag=';
imgTag+='<p><img src="'+file.getBlob()+'"id="image-box"/>/p>'
// file.getBlob() is also not displayed as file.getUrl().
return(imgTag);
}
showPic.html side
<input type="button" value="getPic" onclick="google.script.run.withSuccessHandler(onSuccessImg).getPic('fileID_string')">
function onSuccessImg(res){
varimgBox= document.getElementById("image-box");
imgBox.innerHTML=res;
}
<html>
<body>
<p><img src="xxxx" id="image-box"/></p>
</body>
</html>
File ID seen from https://drive.google.com/uc?export=view&id=GoogleDrive
If it is the URL of , it should be displayed
"From Google Drive" is Kimo.
© 2024 OneMinuteCode. All rights reserved.