From 0437d346caadd897e7db8fe24277cf1f635430fd Mon Sep 17 00:00:00 2001 From: nhat-thien <36451175+nhat-thien@users.noreply.github.com> Date: Tue, 23 Oct 2018 17:12:45 +0200 Subject: [PATCH 1/4] Create resize.sh Automatically resizing images, an alternative for gulp --- resizing-images/resize.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 resizing-images/resize.sh diff --git a/resizing-images/resize.sh b/resizing-images/resize.sh new file mode 100644 index 000000000..7e24220bf --- /dev/null +++ b/resizing-images/resize.sh @@ -0,0 +1,4 @@ +mkdir ./resized/; +for photos in *.jpg *.png *.jpeg; +do convert -verbose $photos -background white -flatten -resize 2000 ./resized/$photos.jpg && convert -verbose $photos -background white -flatten -resize 2000 ./resized/$photos\_lg.jpg && convert -verbose $photos -background white -flatten -resize 1000 ./resized/$photos\_md.jpg && convert -verbose $photos -background white -flatten -resize 768 ./resized/$photos\_sm.jpg && convert -verbose $photos -background white -flatten -resize 575 ./resized/$photos\_xs.jpg && convert -verbose $photos -background white -flatten -resize 256 ./resized/$photos\_placehold.jpg && convert -verbose $photos -background white -flatten -resize 535 ./resized/$photos\_thumb.jpg && convert -verbose $photos -background white -flatten -resize 1070 ./resized/$photos\_thumb@2x.jpg; +done From d4deb1cdbc4616c0c82ccd85052951695463ee84 Mon Sep 17 00:00:00 2001 From: nhat-thien <36451175+nhat-thien@users.noreply.github.com> Date: Tue, 23 Oct 2018 17:25:39 +0200 Subject: [PATCH 2/4] A short guide --- resizing-images/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 resizing-images/README.md diff --git a/resizing-images/README.md b/resizing-images/README.md new file mode 100644 index 000000000..3377b9df9 --- /dev/null +++ b/resizing-images/README.md @@ -0,0 +1,11 @@ +# Using + +Make sure `sudo chmod 777 resize.sh` (Only need once for the first time) + +Whenever you create a new post: + +1. Put the featured image in the same folder with `resize.sh` +2. Run `./resize.sh` +3. Done + +It will create a new folder called `resized` contains all resized-named images (i.e, `*_lg.jpg`, `*_md.jpg`, `*_placehold.jpg`,...) for your post. From 91e54f9d81a57e9be40ffa8963ef035051818758 Mon Sep 17 00:00:00 2001 From: nhat-thien <36451175+nhat-thien@users.noreply.github.com> Date: Tue, 23 Oct 2018 17:29:50 +0200 Subject: [PATCH 3/4] Update README.md --- resizing-images/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resizing-images/README.md b/resizing-images/README.md index 3377b9df9..1146bf573 100644 --- a/resizing-images/README.md +++ b/resizing-images/README.md @@ -1,8 +1,14 @@ +# Purpose + +A simple alternative for `gulp` in case you can not use `gulp`. + # Using -Make sure `sudo chmod 777 resize.sh` (Only need once for the first time) +Install `ImageMagick` by running the command `sudo apt-get install imagemagick` + +In the folder `resizing-image`, run `sudo chmod 777 resize.sh` (Only need once for the first time) -Whenever you create a new post: +Now, whenever you create a new post: 1. Put the featured image in the same folder with `resize.sh` 2. Run `./resize.sh` From a7dee61b87fcefb0181e2bd21b26078637dedc5a Mon Sep 17 00:00:00 2001 From: nhat-thien <36451175+nhat-thien@users.noreply.github.com> Date: Tue, 23 Oct 2018 17:35:01 +0200 Subject: [PATCH 4/4] Update README.md --- resizing-images/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resizing-images/README.md b/resizing-images/README.md index 1146bf573..ed49440f9 100644 --- a/resizing-images/README.md +++ b/resizing-images/README.md @@ -15,3 +15,9 @@ Now, whenever you create a new post: 3. Done It will create a new folder called `resized` contains all resized-named images (i.e, `*_lg.jpg`, `*_md.jpg`, `*_placehold.jpg`,...) for your post. + +The remain thing to do is to copy the resized-named images to `assets/img/posts/` + +Note that: in the markdown file of your post, `featured-img` should contains the extendsion. + +For example: `featured-img: sky.jpg`