From c00a163cc621efb53651b3d3c1ac658f40cce4f4 Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Mon, 29 Oct 2018 19:11:04 +0100 Subject: [PATCH] update README informations --- README.md | 124 ++++++++++++++++++++++++++----------------------- docs/README.md | 124 ++++++++++++++++++++++++++----------------------- optimize.sh | 3 +- 3 files changed, 131 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index af180da..5b4381a 100644 --- a/README.md +++ b/README.md @@ -1,60 +1,66 @@ -## Bash script to optimize your images and convert them in WebP - -![img-optimize](https://raw.githubusercontent.com/VirtuBox/img-optimize/master/img-optimize.png) - -### Prerequisite - -* jpegoptim -* optipng -* WebP - -Debian/Ubuntu : - -```bash -sudo apt install jpegoptim optipng webp -y -``` - -Centos 7 : - -```bash -sudo yum install optipng jpegoptim libwebp-tools -y -``` - -### What does the script do - -1) optimize jpg images with jpegoptim -2) optimize png images with optipng -3) convert jpg & png images in WebP (without deleting them) - -WebP image name example for mybackground.png : mybackground.png.webp - ---- - -### Usage - -1) Download the script and make it executable - -```bash -wget https://raw.githubusercontent.com/VirtuBox/wp-optimize/master/optimize.sh -chmod +x optimize.sh -``` - -2) Launch the script and set the path of your images as first argument - -```bash -./optimize.sh /path/to/your/images -``` - -To avoid permissions issues, you can run the script with another user with sudo - -```bash -sudo -u www-data ./optimize.sh /path/to/your/images -``` - -### 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 - +## Bash script to optimize your images and convert them in WebP + +![img-optimize](https://raw.githubusercontent.com/VirtuBox/img-optimize/master/img-optimize.png) + +### Prerequisite + +* jpegoptim +* optipng +* WebP + +Debian/Ubuntu : + +```bash +sudo apt install jpegoptim optipng webp -y +``` + +Centos 7 : + +```bash +sudo yum install optipng jpegoptim libwebp-tools -y +``` + +--- + +### Installation + +1) Download the script and make it executable + +```bash +wget -O $HOME/optimize.sh https://raw.githubusercontent.com/VirtuBox/wp-optimize/master/optimize.sh +chmod +x $HOME/optimize.sh +``` + +2) Add an alias in your bashrc + +```bash +echo "alias img-optimize=$HOME/optimize.sh" >> $HOME/.bashrc +source $HOME/.bashrc +``` + + +### Usage + +```bash +Usage: img-optimize [options] + Options: + --jpg ..... optimize all jpg images + --png ..... optimize all png images + --webp ..... convert all images in webp + --nowebp ..... optimize all png & jpg images + --all ..... optimize all images (png + jpg + webp) + Other options : + -h, --help, help ... displays this help information +Examples: + optimize all jpg images in /var/www/images + img-optimize --jpg /var/www/images + +``` + +### 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 is inspired by this [DigitalOcean Community Tutorial](https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website) \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index af180da..5b4381a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,60 +1,66 @@ -## Bash script to optimize your images and convert them in WebP - -![img-optimize](https://raw.githubusercontent.com/VirtuBox/img-optimize/master/img-optimize.png) - -### Prerequisite - -* jpegoptim -* optipng -* WebP - -Debian/Ubuntu : - -```bash -sudo apt install jpegoptim optipng webp -y -``` - -Centos 7 : - -```bash -sudo yum install optipng jpegoptim libwebp-tools -y -``` - -### What does the script do - -1) optimize jpg images with jpegoptim -2) optimize png images with optipng -3) convert jpg & png images in WebP (without deleting them) - -WebP image name example for mybackground.png : mybackground.png.webp - ---- - -### Usage - -1) Download the script and make it executable - -```bash -wget https://raw.githubusercontent.com/VirtuBox/wp-optimize/master/optimize.sh -chmod +x optimize.sh -``` - -2) Launch the script and set the path of your images as first argument - -```bash -./optimize.sh /path/to/your/images -``` - -To avoid permissions issues, you can run the script with another user with sudo - -```bash -sudo -u www-data ./optimize.sh /path/to/your/images -``` - -### 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 - +## Bash script to optimize your images and convert them in WebP + +![img-optimize](https://raw.githubusercontent.com/VirtuBox/img-optimize/master/img-optimize.png) + +### Prerequisite + +* jpegoptim +* optipng +* WebP + +Debian/Ubuntu : + +```bash +sudo apt install jpegoptim optipng webp -y +``` + +Centos 7 : + +```bash +sudo yum install optipng jpegoptim libwebp-tools -y +``` + +--- + +### Installation + +1) Download the script and make it executable + +```bash +wget -O $HOME/optimize.sh https://raw.githubusercontent.com/VirtuBox/wp-optimize/master/optimize.sh +chmod +x $HOME/optimize.sh +``` + +2) Add an alias in your bashrc + +```bash +echo "alias img-optimize=$HOME/optimize.sh" >> $HOME/.bashrc +source $HOME/.bashrc +``` + + +### Usage + +```bash +Usage: img-optimize [options] + Options: + --jpg ..... optimize all jpg images + --png ..... optimize all png images + --webp ..... convert all images in webp + --nowebp ..... optimize all png & jpg images + --all ..... optimize all images (png + jpg + webp) + Other options : + -h, --help, help ... displays this help information +Examples: + optimize all jpg images in /var/www/images + img-optimize --jpg /var/www/images + +``` + +### 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 is inspired by this [DigitalOcean Community Tutorial](https://www.digitalocean.com/community/tutorials/how-to-create-and-serve-webp-images-to-speed-up-your-website) \ No newline at end of file diff --git a/optimize.sh b/optimize.sh index e270574..d966e8d 100644 --- a/optimize.sh +++ b/optimize.sh @@ -16,8 +16,7 @@ _help() { echo " Other options :" echo " -h, --help, help ... displays this help information" echo "Examples:" - echo "" - echo "optimize all jpg images in /var/www/images" + echo " optimize all jpg images in /var/www/images" echo " img-optimize --jpg /var/www/images" echo "" return 0