|
| 1 | +--- |
| 2 | +title: Building a Personal/Team "Permanent" Image Host with Cloudflare R2 + ShareX |
| 3 | +description: "" |
| 4 | +date: "2025-09-27" |
| 5 | +tags: |
| 6 | + - tag-one |
| 7 | +docId: gj4bn01un0s0841berfvwrn5 |
| 8 | +lang: en |
| 9 | +translatedFrom: zh |
| 10 | +translatedAt: 2026-04-15T00:00:00Z |
| 11 | +translatorAgent: claude-opus-4-6 |
| 12 | +--- |
| 13 | + |
| 14 | +# Building a Personal/Team "Permanent" Image Host with Cloudflare R2 + ShareX |
| 15 | + |
| 16 | +This guide walks you from zero to a working image host — high-performance, reliable, near-zero cost, and fully under your control — built on Cloudflare R2's free tier and ShareX's workflow automation. |
| 17 | + |
| 18 | +**End result**: press a hotkey to take a screenshot, have the image automatically uploaded to your own storage (or upload existing local images manually), and get a Markdown-formatted link copied straight to your clipboard for seamless writing. |
| 19 | + |
| 20 | +--- |
| 21 | + |
| 22 | +## Contents |
| 23 | + |
| 24 | +1. [Part 1: Configure Cloudflare R2 (cloud storage)](#part-1-configure-cloudflare-r2-cloud-storage) |
| 25 | +2. [Part 2: Configure ShareX (desktop client)](#part-2-configure-sharex-desktop-client) |
| 26 | +3. [Part 3: Optimize the ShareX workflow](#part-3-optimize-the-sharex-workflow) |
| 27 | +4. [F.A.Q. and troubleshooting](#faq-and-troubleshooting) |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Part 1: Configure Cloudflare R2 (cloud storage) |
| 32 | + |
| 33 | +First, enable R2 storage in Cloudflare. |
| 34 | + |
| 35 | + |
| 36 | +### 1.1 Create an R2 bucket |
| 37 | + |
| 38 | +A bucket is the container that holds all your images. |
| 39 | + |
| 40 | +1. Sign in to the Cloudflare dashboard and open **R2** from the left-hand menu. |
| 41 | +2. Click **Create bucket**. |
| 42 | +3. **Bucket name**: enter a globally unique bucket name (for example, `your-org-images-2025`). |
| 43 | +4. **Location**: leave the default **Automatic**. |
| 44 | +5. Click **Create bucket**. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +### 1.2 Enable public access on the bucket |
| 49 | + |
| 50 | +To let uploaded images be served externally, turn on public access. |
| 51 | + |
| 52 | +1. Open the bucket you just created and click the **Settings** tab at the top. |
| 53 | +  |
| 54 | +2. In the **Public Development URL** section below, click **Enable** on the right. |
| 55 | +3. Type the confirmation text. |
| 56 | +  |
| 57 | +4. **Note down** the `https://pub-....r2.dev` URL shown here — this is your public-access domain. |
| 58 | +  |
| 59 | + |
| 60 | +### 1.3 Create an API token for uploads |
| 61 | + |
| 62 | +The API token is the "key" that lets ShareX upload files to R2. |
| 63 | + |
| 64 | +1. Return to the R2 overview page and click **Manage API Tokens** in the top-right corner. |
| 65 | +  |
| 66 | +1. Click **Create Account API token**. |
| 67 | +  |
| 68 | +1. **Permissions**: **you must select `Object Read & Write`**. This is the critical step — read-only permissions will cause uploads to fail. |
| 69 | +  |
| 70 | +1. Click **Create API token**. |
| 71 | +1. **⚠️ Copy and save immediately!** The page displays your `Access Key ID` and `Secret Access Key`. **These two secrets are shown only once** — copy them immediately and paste them somewhere safe. The `Default endpoints` link at the bottom also needs to be saved. |
| 72 | +  |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Part 2: Configure ShareX (desktop client) |
| 77 | + |
| 78 | +### 2.1 Download and install ShareX |
| 79 | + |
| 80 | +Grab the latest version from the official site: [https://getsharex.com/](https://getsharex.com/) |
| 81 | + |
| 82 | +### 2.2 Configure the S3 upload destination |
| 83 | + |
| 84 | +This is the heart of the setup. |
| 85 | + |
| 86 | +1. Open ShareX and, from the main window, click `Destination settings...`. |
| 87 | +2. In the popup, select `Amazon S3` on the left and fill in your configuration on the right. |
| 88 | +3. Fill in your R2 details exactly as shown in the table below: |
| 89 | + |
| 90 | +| ShareX field | What to enter | Notes | |
| 91 | +| --------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | |
| 92 | +| **Access key ID** | Paste the `Access Key ID` you saved | | |
| 93 | +| **Secret access key** | Paste the `Secret Access Key` you saved | | |
| 94 | +| **Region** | Leave blank | | |
| 95 | +| **Endpoints** | Leave blank | |
| 96 | +| **Endpoint** | `https://<your-AccountID>.r2.cloudflarestorage.com` | If you saved this earlier, paste it as-is. Make sure there's no trailing `/`. | |
| 97 | +| **Bucket name** | Your R2 bucket name (for example, `your-org-images-2025`) | | |
| 98 | +| **Upload path** | `img/%y/%mo/%d/` | Organizes images as `img/year/month/day/`, which helps with management. ShareX uses `%` for variables. (Customize as you like.) | |
| 99 | +| **Use custom domain** | **Check this box** | | |
| 100 | +| (Custom domain field) | `https://<the r2.dev public URL you noted down>` | **Note**: only paste the Public Development URL you saved earlier — don't append `$key$`. Modern ShareX handles that automatically. | |
| 101 | + |
| 102 | +#### 2.2.1 Critical Advanced settings |
| 103 | + |
| 104 | +At the bottom of the S3 configuration window, find the **Advanced** section and apply these settings: |
| 105 | + |
| 106 | +- `Set public-read ACL on file`: **must be unchecked**. R2 doesn't support this; leaving it checked will produce `403 Forbidden` errors. |
| 107 | +- `Use path style request`: **must be checked**. R2 requires this request URL style. |
| 108 | + |
| 109 | +### 2.3 Set S3 as the default image uploader |
| 110 | + |
| 111 | +1. Return to the ShareX main window. |
| 112 | +2. Click `Destinations` -> `Image uploader` -> `File uploader` -> and pick `Amazon S3`. |
| 113 | +  |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +## Part 3: Optimize the ShareX workflow |
| 118 | + |
| 119 | +### 3.1 Auto-copy a Markdown link |
| 120 | + |
| 121 | +1. In the ShareX main window, click `Task settings...`. |
| 122 | +2. In the popup, select **`Advanced`** from the lower part of the left sidebar. |
| 123 | +  |
| 124 | +3. Click `ClipboardContentFormat` under `After upload`. |
| 125 | +4. Replace the contents with the Markdown format ``. |
| 126 | + |
| 127 | +### 3.2 Enable auto-copy to clipboard |
| 128 | + |
| 129 | +1. From the main window, under `After upload tasks`, tick `Copy URL to clipboard` on the right. |
| 130 | +  |
| 131 | + |
| 132 | +### 3.3 Change the hotkey |
| 133 | + |
| 134 | +You can change the hotkey under `Hotkey settings` on the main window, giving you a one-shot flow: screenshot → upload → Markdown on your clipboard. |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +## F.A.Q. and Troubleshooting |
| 139 | + |
| 140 | +**Q1: I get a `(403) Forbidden` error when uploading — what now?** |
| 141 | +**A1:** This is the most common issue. Check the following two S3 Advanced settings: |
| 142 | + |
| 143 | +1. Make sure **`Set public-read ACL on file`** is **unchecked**. |
| 144 | +2. Make sure **`Use path style request`** is **checked**. |
| 145 | +3. If it still fails, regenerate an **API token with `Object Read & Write` permissions** and update it in ShareX. |
| 146 | + |
| 147 | +**Q2: I don't want to upload screenshots — I want to upload existing local images.** |
| 148 | +**A2:** |
| 149 | +**Use the Upload tab on the left**: pick the type of content you want to upload from inside that tab. |
| 150 | + |
| 151 | + |
| 152 | +**Q3: Why can't I use PicGo?** |
| 153 | +**A3:** In my testing, PicGo's S3 plugin has compatibility issues with Cloudflare R2 — filenames and paths aren't handled correctly. ShareX's S3 implementation is more standard and currently the more reliable choice. |
0 commit comments