unitedwardrobe / imgproxy-node

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

watermark_url using setOption ? #18

Closed ponez closed 1 year ago

ponez commented 1 year ago

Hi, I'm trying to add watermark to the image and as mentioned before

watermark(opacity, position, offset, scale)

and there isn't a way for the url so I was trying to add it using setOption but

public setOption(option: string, value: string) {
    this.options[option] = value;
  }

Is returning void which might result in a situation like this

      .builder()
      .resize('fit', 300, 200, false)
      .dpr(1)
      .quality(60)
      .watermark(20, WatermarkPosition.south_west, { x: 20, y: 20 }, 0)
      .setOption(
        'watermark_url',
        'base64 encoded url',
      )
      .generateUrl(imageUrl);

which results in TS2339: Property 'generateUrl' does not exist on type 'void'. by adding .setOption()

remq commented 1 year ago

The latest update should fix it (also see this PR: https://github.com/unitedwardrobe/imgproxy-node/pull/22). Watermark URL is a PRO feature which I didn't include in this library.