unitedwardrobe / imgproxy-node

A Node client library to generate urls for imgproxy services.
MIT License
36 stars 8 forks source link

Documentation #8

Open Grawl opened 4 years ago

Grawl commented 4 years ago

Example in readme is ok, but there is more methods I can use like size() instead of resize()

builder.ts looks beautiful but it's good to describe all the things

You can start from something like this:


Methods

Based on imgproxy interface's Generating the URL (Advanced)

resize(type, width, height, enlarge)

size(width, height, enlarge)

dpr(number | string) - Device Pixel Ratio

Multiply image for displaying on screen with DPR > 1

(why string?)

enlarge(boolean)

Enlarge if original smaller than required

gravity(Gravity | FocusPoint)

Set Gravity option or configure Focus Point

quality(number)

Set image quality

background(RGBColor | HexColor)

When you convert an image with alpha-channel to JPEG

blur(number)

Apply the gaussian blur filter

sharpen(number)

Apply the sharpen filter

watermark(opacity, position, offset, scale)

Puts watermark on the processed image

preset(...presets: string[])

Defines a list of presets to be used by imgproxy

(need details here)

cacheBuster(buster: string)

It’s highly recommended to prefer cachebuster option over URL query string because the option can be properly signed.

format(extension: string)

Alias for extension URL part.

Slijkhuis commented 4 years ago

Thank you for the suggestion, we will take it into account in the next update of this project.

koenpunt commented 4 years ago

Thank you for this. It would probably be best to add these as docblocks to the methods in builder, and generate documentation from it, instead of manually writing it out in the README.

(why string?)

Because dpr can be a float, but float precision in javascript sucks.