Skip to content

Commit dfe7810

Browse files
author
chrisben
committed
Fixed README format
1 parent 6490447 commit dfe7810

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

README.md

+33-20
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The core image processing functionality is handled by the
2525

2626
- on the fly image thumbnail generation
2727
- filesystem cache
28-
- URLs are [Thumbor](https://github.com/thumbor/thumbor) compliant
28+
- URLs are [Thumbor](https://github.com/thumbor/thumbor) compatible
2929
- service access can be restricted to avoid abuse
3030
- Docker ready
3131
- easy to set up
@@ -39,28 +39,39 @@ The core image processing functionality is handled by the
3939

4040
## Installation
4141

42-
- clone this project
43-
- ```npm install```
42+
43+
```
44+
git clone git@github.com:chrisben/image-thumb.git && cd image-thumb
45+
```
46+
47+
```
48+
npm install
49+
```
4450

4551
## Usage
4652

4753
### Running the server
4854

49-
```node index.js```
55+
```
56+
node index.js
57+
```
5058

5159
This will run a local server on: http://127.0.0.1:8081/
5260

5361
You can change the port number using the `SERVER_PORT` environment variable
5462
(see _Options_ below).
5563

5664
Alternatively you can run the server using gulp:
57-
```./gulp serve```
65+
66+
```
67+
./gulp serve
68+
```
5869

5970
### Generating thumbnails
6071

6172
To create a thumbnail image:
6273

63-
```http://127.0.0.1:8081/[HMAC/]WIDTHxHEIGHT/[HALIGN/VALIGN/]IMAGE_URL```
74+
`http://127.0.0.1:8081/[HMAC/]WIDTHxHEIGHT/[HALIGN/VALIGN/]IMAGE_URL`
6475

6576
- HMAC: security token
6677
- WIDTH: new width in pixels
@@ -85,7 +96,7 @@ to keep the original aspect ratio. For instance:
8596

8697
Options and their defaults are set in the services/options.js file.
8798
These options can be overridden via environment variables.
88-
For instance you can run: ```LOG_LEVEL=0 node index.js``` to start the server
99+
For instance you can run: `LOG_LEVEL=0 node index.js` to start the server
89100
with logging disabled.
90101

91102
### Security
@@ -111,23 +122,21 @@ The command line tool `command/hmac.js` is provided to generate tokens.
111122

112123
Let's say I want to use the 'mytest' security key like this:
113124

114-
`SECURITY_KEY=mytest node index.js`
125+
```
126+
SECURITY_KEY=mytest node index.js
127+
```
115128

116-
From the given thumbnail URL:
129+
From the given thumbnail URL: `http://127.0.0.1:8081/300x100/https://www.google.fr/images/logo.png`
117130

118-
`http://127.0.0.1:8081/300x100/https://www.google.fr/images/logo.png`
119-
120-
We extract the path:
121-
122-
`/300x100/https://www.google.fr/images/logo.png`
131+
We extract the path: `/300x100/https://www.google.fr/images/logo.png`
123132

124133
Let's generate the security token (HMAC):
125134

126-
`node command/hmac.js mytest /300x100/https://www.google.fr/images/logo.png`
127-
128-
We get the following security token:
135+
```
136+
node command/hmac.js mytest /300x100/https://www.google.fr/images/logo.png
137+
```
129138

130-
`4a79a53213c97c615e4ef50e856dd7797c9dbdb9`
139+
We get the following security token: `4a79a53213c97c615e4ef50e856dd7797c9dbdb9`
131140

132141
Now the thumbnail image can be accessed using the following URL:
133142

@@ -159,11 +168,15 @@ is not downloaded again and instead loaded directly from the filesystem cache.
159168

160169
To build a docker container running the server:
161170

162-
`docker build .`
171+
```
172+
docker build .
173+
```
163174

164175
To run it:
165176

166-
`docker run -p 8081:8081 DOCKER_IMAGE_ID`
177+
```
178+
docker run -p 8081:8081 DOCKER_IMAGE_ID
179+
```
167180

168181
## TODO
169182

0 commit comments

Comments
 (0)