dwyl / dwyl/imgup

add passing an URL and query string params to resize an image?

Open
#127 3 comments 3 reactions 0 assignees View on GitHub
elixir enhancement technical
Dominant language
Elixir
Stars
108
Forks
20
Avg merge
21h 46m
Merged PRs (30d)
4

Description

I added today the following functionality to my toy fork: if a picture is served, you pass a GET request to the endpoint with the URL in the query string and get back a link to a resized WEBP picture from S3. I found some pictures that were served and wanted to use them.

I choose WEBP format to limit traffic on S3 and bandwidth usage on mobile (and [canIUse is :ok](https://caniuse.com/webp)).

To run in a Livebook:

```elixir
map= %{url: , w: 900, h: 600})

URI.parse("https://up-image.fly.dev/api")
|> URI.append_query(URI.encode(map)
|> URI.to_string()
|> Finch.get()
|> Finch.build(MyApp.Finch)
```
or
```bash
curl -X GET https://up-image.fly.dev/api?url=&h=600&w=600
```

It will deliver a `json` reply with the URL of the new file in S3.

Let me know if you find some interest.

Endpoint: (normally works 😀)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.