Image to COS

approved

by bozhang

Upload local images in Markdown to cloud storage (COS, OSS, Qiniu, SM.MS, GitHub) and replace links automatically. - This plugin has not been manually reviewed by Obsidian staff.

66 downloadsUpdated 20d agoMIT

Obsidian Image to COS

Upload local images in your Markdown documents to cloud storage and automatically replace the links.

English | 中文

Features

  • One-click upload: Upload all local images or videos in the current document with a single command
  • Multiple cloud storage support: Tencent Cloud COS, Alibaba Cloud OSS, Qiniu, SM.MS, GitHub
  • Flexible path templates: Organize your media by date, document name, hash, or custom patterns
  • Duplicate detection: Skip already uploaded files using content hash caching
  • Wiki link support: Handles both standard Markdown ![](path) and Obsidian ![[path]] syntax
  • Video support: Upload MP4, WebM, MOV, MKV and more, with native Obsidian video embeds

Installation

From Obsidian Community Plugins

  1. Open Settings → Community plugins
  2. Select Browse and search for "Image to COS"
  3. Select Install, then Enable

Manual Installation

  1. Download main.js, manifest.json, and styles.css from the latest release
  2. Create a folder image-to-cos in your vault's .obsidian/plugins/ directory
  3. Copy the downloaded files into the folder
  4. Restart Obsidian and enable the plugin in Settings → Community plugins

Quick Start

1. Enable the Plugin

  1. Open Obsidian
  2. Go to Settings → Community plugins
  3. Turn off "Restricted mode" (if not already)
  4. Find Image to COS in the installed plugins list and enable it

2. Configure Cloud Storage

  1. Go to Settings → Image to COS
  2. Select your cloud storage provider (Tencent Cloud COS, Alibaba Cloud OSS, Qiniu, SM.MS, or GitHub)
  3. Fill in the required credentials

Example for Tencent Cloud COS:

  • SecretId: Your Tencent Cloud API key ID
  • SecretKey: Your Tencent Cloud API key
  • Bucket: Bucket name (e.g., my-bucket-1250000000)
  • Region: Region code (e.g., ap-guangzhou)
  • Custom URL: Optional, for CDN acceleration
  1. Click Test Connection to verify your configuration

3. Upload Images or Videos

  1. Open a Markdown document containing local images/videos
  2. Press Ctrl/Cmd + P to open the command palette
  3. Run Upload images to cloud storage or Upload videos to cloud storage
  4. The plugin will automatically:
    • Scan for local images/videos in the document
    • Upload them to cloud storage
    • Replace local paths with remote URLs

Supported Image Syntax

The plugin recognizes the following local image formats:

![alt text](images/photo.png)     # Standard Markdown
![[images/photo.png]]             # Obsidian Wiki link
![[images/photo.png|My Photo]]    # Wiki link with alias

Supported Video Syntax

The plugin recognizes the following local video embeds:

![alt text](videos/demo.mp4)     # Standard Markdown embed
![[videos/demo.mp4]]             # Obsidian Wiki embed
![[videos/demo.mp4|Demo]]        # Wiki embed with alias

HTML Tags

The plugin also detects media inside HTML tags and uploads the local files:

<img src="images/photo.png" alt="Photo">

<video controls>
  <source src="videos/demo.mp4" type="video/mp4">
</video>

<video src="videos/direct.webm" controls></video>

Only the src attribute is replaced with the remote URL; the rest of the tag is preserved.

After upload, links are replaced with remote URLs. Obsidian renders ![](remote-url.mp4) as a video player.

Configuration

Open Settings → Image to COS to configure the plugin.

Cloud Storage Selection

Choose your preferred cloud storage provider:

  • Tencent Cloud COS: Requires SecretId, SecretKey, Bucket, and Region
  • Alibaba Cloud OSS: Requires AccessKeyId, AccessKeySecret, Bucket, and Area
  • Qiniu: Requires AccessKey, SecretKey, Bucket, URL, and Area
  • SM.MS: Optional API Token (anonymous upload available with rate limits)
  • GitHub: Requires Personal Access Token, Repository, Branch, and Path

Path Templates

Configure how uploaded images are organized in cloud storage:

TemplatePatternExample
By date{year}/{month}/{day}/{filename}-{hash}.{ext}2026/02/02/screenshot-a1b2c3d4.png
By documentnotes/{note}/{filename}-{hash}.{ext}notes/My Note/screenshot-a1b2c3d4.png
By document path{note-path}/{filename}.{ext}diary/2026/02/My Note/screenshot.png
Pure hashimages/{hash-full}.{ext}images/a1b2c3d4e5f6...png
Timestampimg/{timestamp}-{filename}.{ext}img/1738483200000-screenshot.png

Available variables:

  • {year} - Current year (4 digits)
  • {month} - Current month (2 digits)
  • {day} - Current day (2 digits)
  • {timestamp} - Unix timestamp (milliseconds)
  • {filename} - Original filename (without extension)
  • {ext} - File extension (without dot)
  • {hash} - MD5 hash (first 8 characters)
  • {hash-full} - Full MD5 hash (32 characters)
  • {note} - Current document name (without extension)
  • {note-path} - Current document relative path
  • {uuid} - Random UUID (8 characters)

Cache Management

  • Enable duplicate detection: Skip images/videos that have already been uploaded
  • Clear cache: Remove all cached hash-URL mappings

Supported Image Formats

  • PNG
  • JPG / JPEG
  • GIF
  • WebP
  • SVG
  • BMP

Supported Video Formats

  • MP4
  • WebM
  • MOV
  • M4V
  • MKV
  • AVI
  • OGV
  • 3GP
  • WMV
  • FLV

Note: Video files can be large. GitHub uploads are limited to 100 MB per file, and SM.MS is limited to 5 MB. Tencent Cloud COS, Alibaba Cloud OSS, and Qiniu are recommended for larger videos.

Requirements

  • Obsidian v0.15.0 or higher
  • Desktop only (not supported on mobile)

Security

  • All credentials are stored locally in Obsidian's data.json
  • Network requests are only made to your configured cloud storage endpoint
  • No telemetry or data collection

Development

# Install dependencies
npm install

# Build for development (watch mode)
npm run dev

# Build for production
npm run build

# Run linter
npm run lint

License

MIT

Credits

This plugin uses PicGo-Core for image uploading.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.