A simple and minimalistic image CDN built with PHP.
- Lightweight and fast
- Self-hosted
- Simple upload API with
authKey - Automatic screenshot upload support (Linux & Windows)
- Built-in control panel for file management
-
Clone the repository:
git clone https://github.com/freeutka/DuckCDN.git cd DuckCDN -
Edit
config.php:- Replace all parameters with the ones you need
-
(Optional) Test your setup using
curl:curl -X POST https://your.domain/ \ -F "auth_key=changethis" \ -F "file=@/replace/this.png"
-
If successful, the output will be:
https://your.domain/uploads/random.png -
Proceed to configure automatic screenshot uploading below.
sudo dnf install flameshot xclip curlnano ~/upload_screenshot.sh#!/bin/bash
tmpfile="/tmp/screen_$(date +%s).png"
# Select area and save screenshot
flameshot gui -r > "$tmpfile"
# Upload to your server
response=$(curl -s -X POST https://your.domain/ \
-F "auth_key=changethis" \
-F "file=@$tmpfile")
# Handle response
if [[ "$response" == http* ]]; then
echo "$response" | xclip -selection clipboard
notify-send "✅ Uploaded" "$response"
else
notify-send "❌ Upload failed" "$response"
fi
rm -f "$tmpfile"chmod +x ~/upload_screenshot.sh-
Open Settings → Keyboard → Custom Shortcuts
-
Add a new shortcut:
- Name: CDN Screenshot
- Command:
/home/your_username/upload_screenshot.sh - Shortcut: e.g.,
Shift + Print
- ShareX — free screenshot tool with upload scripting
- Your CDN API endpoint
- Your
auth_key
- Open ShareX
- Go to
Destinations → Custom uploader settings - Click
Newand set the following:
Request:
-
Name:
DuckCDN -
Request type:
POST -
Request URL:
http://your.domain/ ← with trailing slash -
File form name:
file -
Arguments (Form data
multipart/form-data):{ "auth_key": "changethis" }
Response:
- URL:
$response$ - Regex for response URL:
https?://.*(optional)
-
In ShareX, go to
Task Settings → After capture tasks -
Enable:
Upload image to hostCopy URL to clipboard
-
In
Destinations → Image uploader, selectCustom uploaders → DuckCDN
- Press
PrintScreenor select area - Screenshot is uploaded to your server
- CDN link is copied to clipboard
Want to improve or fix something? Make a pull request and we'll review it.