/go/img: img from the Command Line

/go/img reduces the size of oversized images on a server, which saves disk space and speeds up pages. It: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Shrink all large images on one site
/go/img example.com

Arguments

Position Argument Required Notes
1 domain, directory, file, or all Yes What to process. See How the first argument is read.
2 prefix No Only files whose name starts with this text. Ignored if it contains --.
any --md5 No Splits the work into 16 background jobs. See --md5 mode.
any --skip log No With --md5, skips any job that already has a log file. Written as two words.

How the first argument is read

Order Check Result
1 Is it an existing file or directory? Used as given, relative to your current folder.
2 Is it all? Searches /home, which covers every account.
3 Does /home/<value>/www exist? Searches that folder.
4 None of the above <value> does not exist and the command stops.

What gets resized

Rule Detail
Extensions .webp, .jpeg, .jpg, .png. Lowercase only. .gif and uppercase names such as PHOTO.JPG are ignored.
Size Larger than 512 KB. Smaller files are left alone.
Result size Fits within 800 pixels wide and 600 pixels high, with the proportions kept.
Prefix The prefix matches the start of the file name, not the folder. It can contain * wildcards.

A tall image becomes at most 600 pixels high, so a portrait photo ends up much narrower than 800 pixels.

Examples

# All large images on a site
/go/img example.com

# One folder
/go/img /home/example.com/www/wp-content/uploads

# One file
/go/img /home/example.com/www/images/banner.png

# Only files whose names start with "2024"
/go/img example.com 2024

# Large folder of hash-named files, in 16 background jobs
/go/img example.com --md5

# Run again, skipping jobs that already have a log
/go/img example.com --md5 --skip log

# Follow one background job
tail -f /var/log/go/img/example.com-a.log

# Preview which files would be touched (plain find, changes nothing)
find /home/example.com/www -type f \( -name "*.webp" -o -name "*.jpeg" -o -name "*.jpg" -o -name "*.png" \) -size +512k

Output

Situation Message
Resizing an image [<number>/<total>] Resizing <path>...
No matching files No output
Target not found <value> does not exist (exit code 1)
--md5 job started /go/img <target> <char>, then LOG File: /var/log/go/img/<domain>-<char>.log, then a line of dashes
--md5 job skipped /go/img <target> <char> | Skipped

In --md5 mode the command returns at once, with exit code 1, while the jobs keep running. The per-file progress goes to the log files.

See the full reference at /go/img and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *