LANG SELRCT

Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Sunday, August 12, 2018

Google Drive内の画像ファイルをHTMLのimgタグで表示したい


Google Drive内の画像はこのように書くとimgタグで表示できるようです

調べて見つけた書き方を2つ書いておきます

  1. <img id="source" src="https://drive.google.com/uc?export=view&id=FILE_ID">
  2. <img id="source" src="https://drive.google.com/uc?id=ID&.png">



補足


Google Drive内の画像のリンクはこのようになっている
https://drive.google.com/file/d/FILE_ID/view?usp=sharing


そのままHTMLのimgタグのsrcに指定しても読み込んでくれない


こう書くと読み込んでくれるようになる
https://drive.google.com/uc?export=view&id=FILE_ID

またはこう書く
https://drive.google.com/uc?id=ID&.png


Latest post

Creating a template copier app in Google Apps Script

Introduction This article will show you a template copier application in Google Apps Script.  This application will automatically copy a t...