Skip to content

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

@ndrean

Description

@ndrean

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).

To run in a Livebook:

map= %{url: <the url.png>, 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

curl  -X GET  https://up-image.fly.dev/api?url=<the url.jpeg>&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 😀) https://up-image.fly.dev/api

Metadata

Metadata

Assignees

No one assigned

    Labels

    elixirPull requests that update Elixir codeenhancementNew feature or enhancement of existing functionalitytechnicalA technical issue that requires understanding of the code, infrastructure or dependencies

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions