Find a file
Nicola Zambello 654b8b5e64
All checks were successful
Docker CI / release (push) Successful in 47s
ci: remove git server and image tag
2024-05-21 22:21:21 +03:00
.gitea/workflows ci: remove git server and image tag 2024-05-21 22:21:21 +03:00
.dockerignore ci: sharp compatibility with bun 2024-03-25 15:24:31 +02:00
.editorConfig first commit 2024-03-25 11:17:19 +02:00
.gitignore first commit 2024-03-25 11:17:19 +02:00
bun.lockb ci: sharp compatibility with bun 2024-03-25 15:24:31 +02:00
docker-compose.yml first commit 2024-03-25 11:17:19 +02:00
Dockerfile ci: sharp compatibility with bun 2024-03-25 15:24:31 +02:00
index.ts add preview with try now 2024-03-25 11:31:12 +02:00
package.json ci: sharp compatibility with bun 2024-03-25 15:24:31 +02:00
README.md ci: remove git server and image tag 2024-05-21 22:21:21 +03:00
tsconfig.json first commit 2024-03-25 11:17:19 +02:00

resize-img-api

The structure of the API path is:

/api/imgresize/:width/:height/:url

Where :width and :height can be numbers in pixels or auto.

The :url is the URL of the image to be resized and should be URL encoded, which can be done in JS with encodeURIComponent(). See MDN ref.

Example encoded URL for https://memori.ai/logo.png:

https%3A%2F%2Fmemori.ai%2Flogo.png

Then call the API as, for example:

/api/imgresize/200/200/https%3A%2F%2Fmemori.ai%2Flogo.png

You can also specify a format using the querystring ?format= and indicating one of the following: avif, gif, heif, jpeg, jpg, pdf, png, svg, tiff, webp. (Note: Experimental!)

Docker

To build the Docker image:

docker build -t resize-img-api .

To run the Docker container:

docker run -p 8787:8787 resize-img-api

Using the published image:

docker run -p 8787:8787 code.nzambello.dev/nzambello/resize-img-api:latest

Development

To install dependencies:

bun install

To run:

bun start

Or in development mode with hot reloading:

bun dev

This project was created using bun init in bun v1.0.26. Bun is a fast all-in-one JavaScript runtime.