unitedwardrobe/imgproxy-node

Documentation

Opened this issue · 2 comments

Grawl commented

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)

  • type - resize type
  • width - number
  • height - number
  • enlarge - boolean - enlarge if original smaller than required

size(width, height, enlarge)

  • width - number
  • height - number
  • enlarge - boolean - enlarge if original smaller than required

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

  • opacity - number
  • position (optional) - string - ce|no|so|ea|we|noea|nowe|soea|sowe|re
  • offset (optional) - { x: <number>, y: <number> } - not applicable to re position
  • scale (optional) - number - size relative to the resulting image size

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.

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

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.