Files
imup/README.md
David Allemang e24ae6c457 Python rewrite
2026-01-24 23:32:11 -05:00

1.7 KiB

Upload images to self-hosted static file server via sshfs.


Example usage:

Upload an image on the clipboard and copy the url to the clipboard.

$ imup 

Upload an image from one or more files or urls.

$ imup https://example.com/image.png 
$ imup foo.png bar.png baz.png 

Upload an image from stdin.

$ convert foo.png -flip - | imup -

Installation and setup.

This assumes you already have some hosted static files and ssh configured with write permissions to that directory. Images are copied to the host via scp. Thus authentication is deferred to other systems like VPN and SSH, and hosting is deferred to static web servers like nginx. This tool is only a convenience to normalize/strip image data and upload the files.

The client depends on imagemagick, sshfs, and xclip. The host only needs to serve ssh and static files.

apt install imagemagick sshfs xclip

Clone the repository, and install it via tool like pipx or uv.

uv tool install 'imup@git+https://git.allemangd.dev/me/imup.git'

Configure imup with ~/.config/imup.toml. For example, my config is:

[imup]
target = "imup-host:/var/www/i.allemangd.dev"
base_url = "https://i.allemangd.dev/"

Granted write permissions to /var/www/i.allemangd.dev to my ssh user, and configure an ssh host with keys for that user.

# ssh config
Host imup-host
    HostName ...
    User ...
    IdentifyFile ...

Configure the static file host; for example on my host I have the following nginx server config:

# nginx config
server {
    listen 80;  
    # (ssl settings omitted)
    
    server_name i.allemangd.dev;
    
    location / {
        root /var/www/i.allemangd.dev/;
    }
}