Update Changelog and Readme
This commit is contained in:
parent
f445537361
commit
e91fee0836
|
@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
- option --no-run-if-empty added to xargs
|
- option --no-run-if-empty added to xargs
|
||||||
- scripts to compile optipng & libwebp from source
|
- scripts to compile optipng & libwebp from source
|
||||||
- Avif (AV1 Image Format) support
|
- Avif (AV1 Image Format) support
|
||||||
|
- Avoid optimizing the same image at the same moment [PR #12](https://github.com/VirtuBox/img-optimize/pull/12)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
17
README.md
17
README.md
|
@ -81,18 +81,23 @@ Bash script to optimize your images and convert them in WebP
|
||||||
Usage: img-optimize [options] <images path>
|
Usage: img-optimize [options] <images path>
|
||||||
If images path isn't defined, img-optimize will use the current directory
|
If images path isn't defined, img-optimize will use the current directory
|
||||||
Options:
|
Options:
|
||||||
--jpg <images path> ..... optimize all jpg images
|
--jpg ..... optimize all jpg images
|
||||||
--png <images path> ..... optimize all png images
|
--png ..... optimize all png images
|
||||||
--webp <images path> ..... convert all images in webp
|
--webp ..... convert all images in webp
|
||||||
--nowebp <images path> ..... optimize all png & jpg images
|
--avif ..... convert all images in avif
|
||||||
--all <images path> ..... optimize all images (png + jpg + webp)
|
--std ..... optimize all png & jpg images
|
||||||
|
--next ..... convert all images in webp & avif
|
||||||
|
--all ..... optimize all images (png + jpg + webp + avif)
|
||||||
-i, --interactive ..... run img-optimize in interactive mode
|
-i, --interactive ..... run img-optimize in interactive mode
|
||||||
-q, --quiet ..... run image optimization quietly
|
-q, --quiet ..... run image optimization quietly
|
||||||
|
--path <images path> ..... define images path
|
||||||
Other options :
|
Other options :
|
||||||
-h, --help, help ... displays this help information
|
-h, --help, help ... displays this help information
|
||||||
|
--cmin [+|-]<n> ... File's status was last changed n minutes ago.
|
||||||
|
act find cmin argument (+n : greater than n, -n : less than n, n : exactly n)
|
||||||
Examples:
|
Examples:
|
||||||
optimize all jpg images in /var/www/images
|
optimize all jpg images in /var/www/images
|
||||||
img-optimize --jpg /var/www/images
|
img-optimize --jpg --path /var/www/images
|
||||||
```
|
```
|
||||||
|
|
||||||
### Update the script
|
### Update the script
|
||||||
|
|
253
docs/README.md
253
docs/README.md
|
@ -1,120 +1,133 @@
|
||||||
# Image optimization bash script
|
# Image optimization bash script
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://travis-ci.org/VirtuBox/img-optimize)    
|
[](https://travis-ci.org/VirtuBox/img-optimize)    
|
||||||
|
|
||||||
## Prerequisite
|
## Prerequisite
|
||||||
|
|
||||||
- jpegoptim for jpg optimization
|
- jpegoptim for jpg optimization
|
||||||
- optipng for png optimization
|
- optipng for png optimization
|
||||||
- cwebp for WebP conversion
|
- cwebp for WebP conversion
|
||||||
|
- go-avif for Avif conversion
|
||||||
### From APT repositories
|
|
||||||
|
### From APT repositories
|
||||||
Debian/Ubuntu :
|
|
||||||
|
Debian/Ubuntu :
|
||||||
```bash
|
|
||||||
sudo apt install jpegoptim optipng webp -y
|
```bash
|
||||||
```
|
sudo apt install jpegoptim optipng webp -y
|
||||||
|
```
|
||||||
Centos 7 :
|
|
||||||
|
Centos 7 :
|
||||||
```bash
|
|
||||||
sudo yum install optipng jpegoptim libwebp-tools -y
|
```bash
|
||||||
```
|
sudo yum install optipng jpegoptim libwebp-tools -y
|
||||||
|
```
|
||||||
### Compile the latest release (optipng & libwebp)
|
|
||||||
|
### Compile the latest release (optipng & libwebp)
|
||||||
For Debian/Ubuntu (available in scripts folder) :
|
|
||||||
|
For Debian/Ubuntu (available in scripts folder) :
|
||||||
```bash
|
|
||||||
# optipng
|
```bash
|
||||||
curl -sL git.io/fjddn | sudo -E bash
|
# optipng
|
||||||
|
curl -sL git.io/fjddn | sudo -E bash
|
||||||
# libwebp
|
|
||||||
curl -sL git.io/fjdd6 | sudo -E bash
|
# libwebp
|
||||||
```
|
curl -sL git.io/fjdd6 | sudo -E bash
|
||||||
|
```
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
### Go-Avif installation
|
||||||
## Installation
|
|
||||||
|
```bash
|
||||||
1) Clone the repository
|
sudo wget -qO /usr/local/bin/avif https://github.com/Kagami/go-avif/releases/download/v0.1.0/avif-linux-x64
|
||||||
|
sudo chmod +x /usr/local/bin/avif
|
||||||
```bash
|
```
|
||||||
git clone https://github.com/VirtuBox/img-optimize.git $HOME/.img-optimize
|
|
||||||
```
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
2) Install the script
|
## Installation
|
||||||
|
|
||||||
**Method 1** : Add an alias in .bashrc
|
1) Clone the repository
|
||||||
|
|
||||||
With this method img-optimize can only be used by the current user
|
```bash
|
||||||
|
git clone https://github.com/VirtuBox/img-optimize.git $HOME/.img-optimize
|
||||||
```bash
|
```
|
||||||
echo "alias img-optimize=$HOME/.img-optimize/optimize.sh" >> $HOME/.bashrc
|
|
||||||
source $HOME/.bashrc
|
2) Install the script
|
||||||
```
|
|
||||||
|
**Method 1** : Add an alias in .bashrc
|
||||||
**Method 2** : Add an alias to the script in /usr/local/bin
|
|
||||||
|
With this method img-optimize can only be used by the current user
|
||||||
With this method img-optimize can be used by all users
|
|
||||||
|
```bash
|
||||||
```bash
|
echo "alias img-optimize=$HOME/.img-optimize/optimize.sh" >> $HOME/.bashrc
|
||||||
sudo ln -s $HOME/.img-optimize/optimize.sh /usr/local/bin/img-optimize
|
source $HOME/.bashrc
|
||||||
sudo chmod +x /usr/local/bin/img-optimize
|
```
|
||||||
```
|
|
||||||
|
**Method 2** : Add an alias to the script in /usr/local/bin
|
||||||
## Usage
|
|
||||||
|
With this method img-optimize can be used by all users
|
||||||
```bash
|
|
||||||
Bash script to optimize your images and convert them in WebP
|
```bash
|
||||||
Usage: img-optimize [options] <images path>
|
sudo ln -s $HOME/.img-optimize/optimize.sh /usr/local/bin/img-optimize
|
||||||
If images path isn't defined, img-optimize will use the current directory
|
sudo chmod +x /usr/local/bin/img-optimize
|
||||||
Options:
|
```
|
||||||
--jpg <images path> ..... optimize all jpg images
|
|
||||||
--png <images path> ..... optimize all png images
|
## Usage
|
||||||
--webp <images path> ..... convert all images in webp
|
|
||||||
--nowebp <images path> ..... optimize all png & jpg images
|
```bash
|
||||||
--all <images path> ..... optimize all images (png + jpg + webp)
|
Bash script to optimize your images and convert them in WebP
|
||||||
-i, --interactive ..... run img-optimize in interactive mode
|
Usage: img-optimize [options] <images path>
|
||||||
-q, --quiet ..... run image optimization quietly
|
If images path isn't defined, img-optimize will use the current directory
|
||||||
Other options :
|
Options:
|
||||||
-h, --help, help ... displays this help information
|
--jpg ..... optimize all jpg images
|
||||||
Examples:
|
--png ..... optimize all png images
|
||||||
optimize all jpg images in /var/www/images
|
--webp ..... convert all images in webp
|
||||||
img-optimize --jpg /var/www/images
|
--avif ..... convert all images in avif
|
||||||
```
|
--std ..... optimize all png & jpg images
|
||||||
|
--next ..... convert all images in webp & avif
|
||||||
## Update the script
|
--all ..... optimize all images (png + jpg + webp + avif)
|
||||||
|
-i, --interactive ..... run img-optimize in interactive mode
|
||||||
To update the script, just run :
|
-q, --quiet ..... run image optimization quietly
|
||||||
|
--path <images path> ..... define images path
|
||||||
```bash
|
Other options :
|
||||||
git -C $HOME/.img-optimize pull
|
-h, --help, help ... displays this help information
|
||||||
```
|
--cmin [+|-]<n> ... File's status was last changed n minutes ago.
|
||||||
|
act find cmin argument (+n : greater than n, -n : less than n, n : exactly n)
|
||||||
## Setup daily cronjob
|
Examples:
|
||||||
|
optimize all jpg images in /var/www/images
|
||||||
You just have to copy the scripts to /etc/cron.daily :
|
img-optimize --jpg --path /var/www/images
|
||||||
|
```
|
||||||
```bash
|
|
||||||
cp $HOME/.img-optimize/crons/jpg-png-cron.sh /etc/cron.daily/jpg-png-cron
|
### Update the script
|
||||||
cp $HOME/.img-optimize/crons/jpg-png-cron.sh /etc/cron.daily/webp-cron
|
|
||||||
|
To update the script, just run :
|
||||||
chmod +x /etc/cron.daily/jpg-png-cron
|
|
||||||
chmod +x /etc/cron.daily/webp-cron
|
```bash
|
||||||
```
|
git -C $HOME/.img-optimize pull
|
||||||
|
```
|
||||||
Then just edit your websites path set with the variables `sites` at the beginning of the cron scripts.
|
|
||||||
|
### Setup daily cronjob
|
||||||
## Warning
|
|
||||||
|
You just have to copy the scripts to /etc/cron.daily :
|
||||||
Conversion process can take a while, you can use `tmux` to launch the script and be able to close your ssh connection without interrupting conversion. Then just use `tmux attach` to login back in your tmux session.
|
|
||||||
|
```bash
|
||||||
## Credits
|
cp $HOME/.img-optimize/crons/jpg-png-cron.sh /etc/cron.daily/jpg-png-cron
|
||||||
|
cp $HOME/.img-optimize/crons/jpg-png-cron.sh /etc/cron.daily/webp-cron
|
||||||
- WebP conversion script was inspired by this [DigitalOcean Community Tutorial](https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website)
|
|
||||||
|
chmod +x /etc/cron.daily/jpg-png-cron
|
||||||
- Tutorial about webp conversion available on [jesuisadmin.fr](https://jesuisadmin.fr/convertir-vos-images-en-webp-nginx/) (in french)
|
chmod +x /etc/cron.daily/webp-cron
|
||||||
|
```
|
||||||
|
|
||||||
|
Then just edit your websites path set with the variables `sites` at the beginning of the cron scripts.
|
||||||
|
|
||||||
|
## Warning
|
||||||
|
|
||||||
|
Conversion process can take a while, you can use `tmux` to launch the script and be able to close your ssh connection without interrupting conversion. Then just use `tmux attach` to login back in your tmux session.
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
|
||||||
|
- WebP conversion script was inspired by this [DigitalOcean Community Tutorial](https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website)
|
||||||
|
|
||||||
|
- Tutorial about webp conversion available on [jesuisadmin.fr](https://jesuisadmin.fr/convertir-vos-images-en-webp-nginx/) (in french)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user