Skip to content

Commit

Permalink
Adding other instructions to use and settings to use loader().
Browse files Browse the repository at this point in the history
  • Loading branch information
keirantai committed Jul 22, 2013
1 parent a8a3f12 commit 5fb32b2
Showing 1 changed file with 60 additions and 4 deletions.
64 changes: 60 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,80 @@ This project is designed for express web application framework, you may use it w
...
app.use(require('nodejs-fastload').loader());

Once it restarted your web app, **FastLoad** by default will handle all requests with prefix "/l". That is http://[domain name]/l/[parameters or "_" means nothing]/[original image URL].
Once it restarted your web app, **FastLoad** by default will handle all requests with prefix "/l". That is

http://[domain name]/l/[parameters or "_" means nothing]/[original image URL]

For example, if you want to load a image URL with **FastLoad**, you may load your image as below.

http://yourdomainname.com/l/_/http://www.google.com/images/srpr/logo4w.png

The above image URL (http://www.google.com/images/srpr/logo4w.png) can be either internal or external image link.

**Use different prefix of URL**

In case, you don't want to use "/l" prefix as the default URI for **FastLoad** module. You can specify your own URI as below.

var app = express();
...
app.use(require('nodejs-fastload').loader('/myownuri'));

## Advanced

Apart from the loading optimization, this project makes use of GraphicMagick module to enable image manipulation on-the-fly. You can replace the "_" from the parameteres part to any of the following configurations.

**Resizing an image**

To resizing an image, you need to specify the maximum width and height of the new image size. **FastLoad** will resize the image within the maximum size on proportion.
To resize an image, you need to specify the maximum width and height of the new image size. **FastLoad** will resize the image within the maximum size on proportion.

http://[domain name]/l/**[max. width]x[max. height]**/[original image URL]
http://[domain name]/l/[max. width]x[max. height]/[original image URL]

Example:

http://yourdomainname.com/l/**100x100**/http://www.google.com/images/srpr/logo4w.png
http://yourdomainname.com/l/100x100/http://www.google.com/images/srpr/logo4w.png

**Cropping an image**

To crop and image, you have to specify the new width and height of the image with prefix "c".

http://[domain name]/l/c[new width]x[new height]/[original image URL]

Example:

http://yourdomainname.com/l/c100x100/http://www.google.com/images/srpr/logo4w.png

**Rotating an image**

To rotate the angel of an image, you simply tell the degrees of the angel with prefix "r".

http://[domain name]/l/r[degrees of the angel]/[original image URL]

Example:

http://yourdomainname.com/l/r90/http://www.google.com/images/srpr/logo4w.png

**Flopping an image from left-to-right or vice versa**

To flop an image, you only give the keyword "flop".

http://[domain name]/l/flop/[original image URL]

Example:

http://yourdomainname.com/l/flop/http://www.google.com/images/srpr/logo4w.png

**Changing quality of an image**

To change the quality of an image, you can specify the percentage of quality from 1 to 100 as low to high with prefix "q".

http://[domain name]/l/q[percentage of quality]/[original image URL]

Example:

http://yourdomainname.com/l/q100/http://www.google.com/images/srpr/logo4w.png

### Multiple Options

In additions to the single setting of the image manipulation, **FastLoad** also supports implement multiple options by using comma separator. Such as you may want to resize an image to 100px width and 100px height, meanwile, to rotate the image 90 degrees.

http://yourdomainname.com/l/100x100,r90/http://www.google.com/images/srpr/logo4w.png

0 comments on commit 5fb32b2

Please sign in to comment.