Skip to content

Commit d56f005

Browse files
authored
Create thumbnail.gs
1 parent 3e1295c commit d56f005

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

slides/thumbnail/thumbnail.gs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Saves a thumbnail image of the current Google Slide presentation in Google Drive.
3+
* Logs the image URL.
4+
* @param {number} i The zero-based slide index. 0 is the first slide.
5+
* @example saveThumbnailImage(0)
6+
*/
7+
function saveThumbnailImage(i) {
8+
var presentation = SlidesApp.getActivePresentation();
9+
var thumbnail = Slides.Presentations.Pages.getThumbnail(presentation.getId(),
10+
presentation.getSlides()[i].getObjectId());
11+
var response = UrlFetchApp.fetch(thumbnail.contentUrl);
12+
var image = response.getBlob();
13+
var file = DriveApp.createFile(image);
14+
Logger.log(file.getUrl());
15+
}

0 commit comments

Comments
 (0)