LoginSignup
0
0

Googleドライブ上の画像を公開してWebサイトに組み込みたい時

Last updated at Posted at 2024-04-21

Google Driveのリンクを直接画像として扱う場合は、URLが直接画像へのリンクである必要がある。

https://drive.google.com/uc?export=view&id=ファイルID
の形式である必要がある。

※ファイルIDは、https://drive.google.com/file/d/ の後ろの部分

Next.jsで構築したサイト上に画像を載せる場合

Next.jsではセキュリティ上の理由から、外部の画像ホストを使用する前に設定ファイルで明示的に許可する必要がある。

next.config.js
module.exports = {
  images: {
    domains: ['drive.google.com'],
  },
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0