README file from
GithubObsidian 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
and Obsidian![[path]]syntax - Video support: Upload MP4, WebM, MOV, MKV and more, with native Obsidian video embeds
Installation
From Obsidian Community Plugins
- Open Settings → Community plugins
- Select Browse and search for "Image to COS"
- Select Install, then Enable
Manual Installation
- Download
main.js,manifest.json, andstyles.cssfrom the latest release - Create a folder
image-to-cosin your vault's.obsidian/plugins/directory - Copy the downloaded files into the folder
- Restart Obsidian and enable the plugin in Settings → Community plugins
Quick Start
1. Enable the Plugin
- Open Obsidian
- Go to Settings → Community plugins
- Turn off "Restricted mode" (if not already)
- Find Image to COS in the installed plugins list and enable it
2. Configure Cloud Storage
- Go to Settings → Image to COS
- Select your cloud storage provider (Tencent Cloud COS, Alibaba Cloud OSS, Qiniu, SM.MS, or GitHub)
- 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
- Click Test Connection to verify your configuration
3. Upload Images or Videos
- Open a Markdown document containing local images/videos
- Press
Ctrl/Cmd + Pto open the command palette - Run Upload images to cloud storage or Upload videos to cloud storage
- 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:
 # 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:
 # 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="https://raw.githubusercontent.com/mrelvin/obsidian-image-to-cos/HEAD/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  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:
| Template | Pattern | Example |
|---|---|---|
| By date | {year}/{month}/{day}/{filename}-{hash}.{ext} |
2026/02/02/screenshot-a1b2c3d4.png |
| By document | notes/{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 hash | images/{hash-full}.{ext} |
images/a1b2c3d4e5f6...png |
| Timestamp | img/{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
Credits
This plugin uses PicGo-Core for image uploading.