Install imgdrop
You need a small server, a folder for the images and, if you want a nice address, a reverse proxy. Allow ten minutes.
Requirements
- A Linux machine (x86-64 or ARM64). It idles at around 15 MB of memory.
- A directory with enough space for your images, writable by the user that runs imgdrop.
- A web server or reverse proxy if you want HTTPS and a host name such as
img.example.net.
1. Download and run the binary
Download the build for your architecture, make it executable and start it:
sudo useradd --system --home /var/lib/imgdrop imgdrop
sudo mkdir -p /var/lib/imgdrop
sudo chown imgdrop: /var/lib/imgdrop
chmod +x ./imgdrop
sudo -u imgdrop ./imgdrop --data /var/lib/imgdrop --listen 127.0.0.1:8080Open 127.0.0.1:8080 in a browser on the same machine and drop a test image. If you get a link back, it works.
Keep it running
A minimal systemd unit is enough:
[Unit]
Description=imgdrop
After=network.target
[Service]
User=imgdrop
ExecStart=/usr/local/bin/imgdrop --data /var/lib/imgdrop --listen 127.0.0.1:8080
Restart=on-failure
[Install]
WantedBy=multi-user.target2. Or use Docker
docker run -d --name imgdrop -p 127.0.0.1:8080:8080 -v imgdrop-data:/data -e IMGDROP_BASE_URL=https://img.example.net imgdrop:latestThe image keeps everything in /data, so a named volume or a bind mount is all you need to persist.
3. Put a reverse proxy in front
imgdrop speaks plain HTTP and expects something else to handle HTTPS. A sample block in nginx syntax; any reverse proxy works the same way:
server {
listen 443 ssl;
server_name img.example.net;
# your certificate lines here
client_max_body_size 12m;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Keep the proxy body limit a little above imgdrop's own maximum upload size, otherwise people see a generic proxy error instead of imgdrop's message.
Settings
Every setting is a flag or an environment variable. Flags win if both are set.
| Flag | Environment variable | Default | Meaning |
|---|---|---|---|
--data | IMGDROP_DATA | ./data | Directory where images and metadata are stored. |
--listen | IMGDROP_LISTEN | 127.0.0.1:8080 | Address and port to listen on. |
--max-size | IMGDROP_MAX_SIZE | 10MB | Largest accepted upload. |
--expiry | IMGDROP_EXPIRY | never | Default lifetime of an image, e.g. 24h, 7d, never. |
--password | IMGDROP_PASSWORD | empty | If set, uploading requires this password. Viewing stays open. |
--base-url | IMGDROP_BASE_URL | from request | Public address used when building short links. |
--keep-exif | IMGDROP_KEEP_EXIF | false | Keep EXIF data instead of stripping it. |
Updating
Stop the service, replace the binary with the new one, start it again. The data directory format is stable inside a major version; the release notes say when that changes.
sudo systemctl stop imgdrop
sudo install -m 755 ./imgdrop /usr/local/bin/imgdrop
sudo systemctl start imgdropWith Docker, pull the new image and recreate the container with the same volume.
Backing up
Everything lives in the data directory, so a backup is a copy of it:
rsync -a /var/lib/imgdrop/ /backups/imgdrop/You can do this while imgdrop is running. To restore, put the files back and start the program.