unitedwardrobe / imgproxy-node

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

update typescript resizing type to match current imgproxy API #19

Closed tibohei closed 1 year ago

tibohei commented 1 year ago

The typescript type ResizingType does not match current imgproxy API definition. This should be corrected.

Expected Behavior

Typescript types should align with imgproxy API interface

Current Behavior

This library defines ResizingType as

export type ResizingType = 'fit' | 'fill' | 'crop';

The most recent imageproxy API documentation defines resizing_type as

Resizing type

Defines how imgproxy will resize the source image. Supported resizing types are:

  • fit: resizes the image while keeping aspect ratio to fit a given size.
  • fill: resizes the image while keeping aspect ratio to fill a given size and crops projecting parts.
  • fill-down: the same as fill, but if the resized image is smaller than the requested size, imgproxy will crop the result to keep the requested aspect ratio.
  • force: resizes the image without keeping the aspect ratio.
  • auto: if both source and resulting dimensions have the same orientation (portrait or landscape), imgproxy will use fill. Otherwise, it will use fit.

Default: fit

Possible Solution

remq commented 1 year ago

This repo isn't actively maintained anymore, but I just updated it to modernise it a bit (https://github.com/unitedwardrobe/imgproxy-node/commit/d3bbd168b763dfa7de29784c848785723a8cdbc6). I'm not a maintainer of the NPM repository, but I've asked for it to be deployed. This would include this change as well.

review all other type definitions and compare with current imgproxy API definition

Didn't have time to do this, but feel free to create a PR.