WebP images are usually much smaller than JPEG, PNG, and GIF files at similar quality, which makes pages load faster. /go/webp converts the images already on your server. It: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.
Quick start
# Convert a site but keep the originals (safe first test)
/go/webp example.com --keep
Arguments
| Position | Argument | Required | Notes |
|---|---|---|---|
| 1 | domain, directory, file, or all |
Yes | What to convert. See How the first argument is read. |
| 2 | database |
No | A database whose Image table should be updated. Ignored if the argument contains --. |
| any | --keep |
No | Keep the original images. It works in any position. |
The database must be the second argument. In /go/webp example.com --keep mydb, the second argument is --keep, so mydb is ignored.
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 converted
| Rule | Detail |
|---|---|
| Extensions | .jpg, .jpeg, .png, .gif, .bmp. Lowercase only, so PHOTO.JPG is skipped. |
| Folders | Searched recursively. |
| Size | No limit. Small images are converted too. |
| Quality | Fixed at 80 (lossy), including for PNG. |
| Output | <name>.webp in the same folder, replacing any existing file of that name. |
Examples
# Convert one site and keep the originals
/go/webp example.com --keep
# Convert one folder
/go/webp /home/example.com/www/uploads --keep
# Convert one file
/go/webp /home/example.com/www/images/banner.png --keep
# Convert and delete the originals
/go/webp example.com
# Convert, delete the originals, and update the Image table in a database
/go/webp example.com example_db
# Convert every site, keeping the originals
/go/webp all --keep
# Check that the converter is installed
command -v cwebp
Output
[1/250] Converting /home/example.com/www/img/photo.jpg to /home/example.com/www/img/photo.webp...
| Message | Meaning |
|---|---|
[<n>/<total>] Converting <file> to <file.webp>... |
One line per image. |
<value> does not exist |
The first argument was not found. Exit code 1. |
Errors from cwebp or MariaDB |
A conversion or database update failed. |
There is no summary at the end, and nothing says whether a conversion worked. A failed conversion leaves the original in place.
See the full reference at /go/webp 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.
