Skip to content

Commit d2e0a35

Browse files
authored
Merge pull request thingsboard#783 from smatvienko-tb/image-preview-generator-doc-and-improve
[3.3.3] Preview generator documented. Generate-preview script usability improved
2 parents 7190f4e + 46e2f32 commit d2e0a35

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* [Fork this repository](https://help.github.com/articles/fork-a-repo/)
44
* [Deploy the site locally](#deployment-of-the-site-locally)
55
* Add your changes
6+
* [Generate image preview](#image-preview-generator)
67
* [Create Pull Request](https://help.github.com/articles/creating-a-pull-request/)
78

89
## Deployment of the site locally
@@ -44,3 +45,22 @@ or execute the below script from the project root directory:
4445

4546
Your copy of the site will then be viewable at: [http://localhost:4000](http://localhost:4000)
4647
(or wherever Jekyll tells you).
48+
49+
## Image preview generator
50+
51+
For new *.png images preview is required along with original images.
52+
53+
To create a previews use the script
54+
````bash
55+
#run once
56+
#install mogrify utility to perform resize
57+
sudo apt install graphicsmagick-imagemagick-compat
58+
````
59+
Usage:
60+
```bash
61+
./generate-previews.sh path file_mask*.png
62+
```
63+
Example:
64+
```bash
65+
./generate-previews.sh images/solution-templates *.png
66+
```

generate-previews.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,17 @@ YELLOW='\033[1;33m'
77
BROWN='\033[0;33m'
88
NC='\033[0m'
99
[ $# -eq 0 ] && { echo "Usage: $0 path_to_folder filter"; exit 1; }
10-
10+
[ -z "$2" ] && { echo "Filter not provided and was set to default *.png"; filter="*.png"; }
11+
12+
# Check if mogrify installed
13+
if ! command -v mogrify &> /dev/null
14+
then
15+
echo "'mogrify' not found"
16+
echo "To install it use the command:"
17+
echo "sudo apt install graphicsmagick-imagemagick-compat"
18+
exit 1
19+
fi
20+
1121
if [ -d "$dir" -a ! -h "$dir" ]
1222
then
1323
echo -e "${YELLOW}$dir${GREEN} found. Processing...${NC}"

0 commit comments

Comments
 (0)