Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternative for gulp #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions resizing-images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Purpose

A simple alternative for `gulp` in case you can not use `gulp`.

# Using

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)

Now, 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.

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`
4 changes: 4 additions & 0 deletions resizing-images/resize.sh
Original file line number Diff line number Diff line change
@@ -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\[email protected];
done