Image to COS

by bozhang
5
4
3
2
1
Score: 50/100

Description

An Obsidian plugin for uploading images to COS.

Reviews

No reviews yet.

Stats

0
stars
95
downloads
0
forks
78
days
53
days
53
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
20
commits

Latest Version

2 months ago

Changelog

README file from

Github

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 ![](https://raw.githubusercontent.com/mrelvin/obsidian-image-to-cos/HEAD/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](https://raw.githubusercontent.com/mrelvin/obsidian-image-to-cos/HEAD/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](https://raw.githubusercontent.com/mrelvin/obsidian-image-to-cos/HEAD/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="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 ![](https://raw.githubusercontent.com/mrelvin/obsidian-image-to-cos/HEAD/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:

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

MIT

Credits

This plugin uses PicGo-Core for image uploading.