webp_server_go icon indicating copy to clipboard operation
webp_server_go copied to clipboard

Support data url scheme

Open vanodevium opened this issue 9 months ago • 4 comments

It would be really cool to add support for data url for cases where the files don't physically exist on the file system and there are only a data url strings.

For security reasons, you can disable this functionality by default and enable it only if there is a feature flag (ex. WEBP_DATA_URL_ENABLED).

there is example of parsing

vanodevium avatar Mar 02 '25 11:03 vanodevium

Currently I use the following algorithm:

  1. receive POST data
  2. decode the "content" of each key with data url string
  3. write "content" to disk
  4. send a request to the webp service
  5. receive a response with webp file
  6. write the webp file to disk
  7. delete the file with the original "content"

As you can see, with the support of data urls, my algorithm could be greatly simplified.

vanodevium avatar Mar 02 '25 11:03 vanodevium

Good idea! @vanodevium , let's see if we can add this feature in future versions. cc @BennyThink

n0vad3v avatar Mar 03 '25 07:03 n0vad3v

@n0vad3v @BennyThink

I thought of another important thing: since the data url can be a very long string, maybe you should provide the ability to make post requests to the webp.

vanodevium avatar Mar 03 '25 10:03 vanodevium

Agreed.

n0vad3v avatar Mar 03 '25 11:03 n0vad3v