GitHub Image Resizer

Convert GitHub markdown image uploads to HTML <img> tags with customizable width; supports drag-drop, paste, and attachment button uploads.

作者
miked49er
日安装量
0
总安装量
0
评分
0 0 0
版本
1.3
创建于
2025-06-11
更新于
2025-06-11
大小
4.7 KB
许可证
MIT
适用于

📐 Tampermonkey GitHub Image Resizer

A Tampermonkey userscript that automatically converts uploaded image Markdown in GitHub Pull Requests into an HTML <img> tag with a customizable width.

This tool supports all GitHub image upload methods — including drag-and-drop, paste, and the attachment button — and ensures consistent visual layout for embedded images.


🚀 Features

  • 🖼️ Automatically converts this:

    ![alt text](https://github.com/user-attachments/assets/...)
    

    into:

    <img src="https://github.com/user-attachments/assets/..." alt="alt text" width="300">
    
  • ✅ Supports all image upload methods:

    • Drag-and-drop from desktop 💾
    • Clipboard paste 📋
    • Attachment button 📎
  • 🔁 Converts image Markdown to HTML <img> on-the-fly — no need to manually edit it.

  • ⚙️ Customizable width via Tampermonkey menu

  • 🧠 Intelligent detection even when GitHub silently updates the comment box after uploads


🧩 Installation

  1. Install Tampermonkey:

  2. Install the script:

    • From GreasyFork
    • Or manually:
    • Click the Tampermonkey icon → "Create a new script"
    • Paste contents of github-pr-image-to-html.user.js
    • Save

🛠 How to Set Custom Image Width

  1. Click the Tampermonkey icon in your browser.
  2. Open the menu for "GitHub PR Image to HTML (Custom Width)".
  3. Click "Set Image Width".
  4. Enter a value (e.g. 400) to apply that width (in pixels) to all converted images.

Your setting is stored and applied persistently across sessions.


🔒 Privacy

  • ✅ The script only runs on https://github.com/*
  • ❌ It does not send or store any data externally
  • ✅ Your preferences are stored locally in Tampermonkey

📤 Contributing

Pull requests are welcomed for:

  • Additional customizations (e.g. height, class, max-width)
  • Theme-aware image styling
  • Integration with GitHub Markdown preview styling

📄 License

MIT License — see LICENSE


🧪 Example

Before Upload:

Oredered Listocat

After Upload (Automatically):

Ordered Listocat

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址