Skip to content

jfvoliveira/imgurpload

Repository files navigation

imgurpload - Chrome/Brave Extension

A Chrome/Brave Manifest V3 extension that allows you to upload images to Imgur with a simple right-click. Perfect for quickly sharing images online!

Features

  • Right-click upload: Right-click any image on any website to upload it to Imgur
  • Automatic link copying: The Imgur link is automatically copied to your clipboard
  • Configurable behavior: Customize how the extension behaves after upload
  • Direct image links: Option to open direct image URLs instead of Imgur pages
  • Focus control: Choose whether to focus the new tab or stay on current page
  • Notification control: Enable/disable browser notifications
  • Anonymous uploads: No Imgur account required - uses public Client ID
  • Cross-origin support: Works with images from any website
  • File type validation: Supports JPEG, PNG, GIF, WebP, BMP, TIFF
  • Size validation: Maximum file size of 10MB

Installation

Development Installation

  1. Clone or download this repository
  2. Load the extension:
    • Open Chrome/Brave and go to chrome://extensions/
    • Enable "Developer mode"
    • Click "Load unpacked" and select this folder
  3. That's it! No configuration needed - uses public Client ID

Production Installation

Once published to Chrome Web Store, users can install it directly from the store.

Usage

  1. Find an image on any website
  2. Right-click on the image
  3. Select "imgurpload" from the context menu
  4. Wait for upload - you'll see a notification (if enabled)
  5. Done! The Imgur link is copied to your clipboard and opens in a new tab

Configuration

Access the extension settings by:

  1. Right-click the extension icon in the toolbar
  2. Select "Options" from the context menu
  3. Configure your preferred behavior:
    • Open Direct Image Link: Opens direct image URL instead of Imgur page
    • Do Not Focus New Tab: Keeps focus on current page
    • Copy Image URL to Clipboard: Automatically copies the link
    • Show Browser Notifications: Enable/disable popup notifications

How It Works

Technical Details

  • Manifest V3: Uses the latest Chrome extension standard
  • Service Worker: Handles background processing and API calls
  • Offscreen Document: Manages clipboard operations (required by MV3)
  • Cross-origin Fetch: Safely fetches images from any website
  • Base64 Encoding: Converts images for Imgur API compatibility

File Structure

imgurpload/
├── manifest.json          # Extension configuration
├── background.js          # Service worker (main logic)
├── offscreen.html         # Offscreen document for clipboard
├── offscreen.js           # Clipboard handling
├── icons/                 # Extension icons (16, 32, 48, 128px)
└── README.md             # This file

API Integration

Imgur API

  • Endpoint: POST https://api.imgur.com/3/image
  • Authentication: Client-ID header
  • Format: Base64 encoded images
  • Response: Returns direct image URL and Imgur page URL

Permissions Required

  • contextMenus: Add right-click menu items
  • notifications: Show upload status
  • clipboardWrite: Copy links to clipboard
  • offscreen: Manage clipboard operations
  • storage: Store user settings
  • <all_urls>: Fetch images from any website

Development

Prerequisites

  • Chrome or Brave browser
  • Basic understanding of Chrome extensions

Local Development

  1. Load the extension in developer mode
  2. Test on various websites with different image types
  3. Check console for any errors during development
  4. Configure settings to test different behaviors

Testing

Test the extension with:

  • Different image formats: JPG, PNG, GIF, WebP
  • Various websites: News sites, social media, e-commerce
  • Different image sizes: Small thumbnails to large images
  • Cross-origin images: Images from different domains

Troubleshooting

Common Issues

"Couldn't fetch image bytes"

  • The image might be protected or blocked
  • Try with a different image or website

"Upload failed"

  • Check your internet connection
  • Check if you've hit Imgur rate limits

Clipboard not working

  • Make sure you've granted clipboard permissions
  • Try refreshing the page and testing again

Debug Mode

  1. Open Chrome DevTools (F12)
  2. Go to Console tab - look for error messages from the extension
  3. Check Service Worker logs:
    • Go to chrome://extensions/
    • Find "imgurpload" extension
    • Click "Service Worker" to open the service worker console
  4. Check the Network tab for API calls

Privacy & Security

  • No data collection: The extension doesn't collect or store personal data
  • Anonymous uploads: Images are uploaded anonymously to Imgur
  • Local storage only: Settings are stored locally in your browser
  • No tracking: No analytics or tracking scripts

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

License

MIT License - feel free to use and modify as needed.

Support

If you encounter issues:

  1. Check the troubleshooting section above
  2. Look at the browser console for error messages
  3. Check the service worker console for detailed logs
  4. Test with different images and websites
  5. Try adjusting the extension settings

Changelog

v1.0.0

  • Initial release
  • Right-click image imgurpload
  • Automatic link copying
  • Cross-origin image support
  • Manifest V3 compatibility
  • Configurable settings
  • Direct image link support
  • Focus control for new tabs
  • Notification preferences
  • Public Client ID (no setup required)

About

Chromium extension to upload to imgur.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors