imgdrop

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

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:8080

Open 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.target

2. 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:latest

The 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.

FlagEnvironment variableDefaultMeaning
--dataIMGDROP_DATA./dataDirectory where images and metadata are stored.
--listenIMGDROP_LISTEN127.0.0.1:8080Address and port to listen on.
--max-sizeIMGDROP_MAX_SIZE10MBLargest accepted upload.
--expiryIMGDROP_EXPIRYneverDefault lifetime of an image, e.g. 24h, 7d, never.
--passwordIMGDROP_PASSWORDemptyIf set, uploading requires this password. Viewing stays open.
--base-urlIMGDROP_BASE_URLfrom requestPublic address used when building short links.
--keep-exifIMGDROP_KEEP_EXIFfalseKeep 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 imgdrop

With 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.