Skip to content

⚡ Write a compressImage() Function using Python #4122

@PineappleIOnic

Description

@PineappleIOnic

💭 Introduction

Appwrite Functions allow you to extend and customize your Appwrite server functionality by executing your custom code 🤩 You can learn more in our official Appwrite Functions docs.

The backbone of Appwrite Functions is Open Runtimes, an environment for serverless cloud computing. Since all Open Runtime functions are valid Appwrite functions, we are looking for contributors to extend the Open Runtimes Examples repository.

Your task is to implement compressImage() function using Python. Please make sure to look at existing function examples and use them as a template for your function. This will help you keep the proper structure as well as provide information on how to test the function.

⚡ Function Details

Perform a lossless compression of an image. Introduce support for tinypng, as well as krakenio. If nessessary, introduce their secret keys as function variables. Provider to use and image to compress should be received as payload in base64 format, and a compressed version should be returned in base64 format.

Example function payload:

{"provider":"tinypng","image":"iVBORw0KGgoAAAANSUhEUgAAAaQAAALiCAY...QoH9hbkTPQAAAABJRU5ErkJggg=="}

Successful function response:

{"success":true,"image":"iVBORw0KGgoAAAANSUhE...o6Ie+UAAAAASU5CYII="}

Error function response:

{"success":false,"message":"Input file is not an image."}

🎯 Requirements

  • Experience with Appwrite.
  • Experience with Python.
  • Knowledge to implement compressImage function.
  • Experience with Docker.

✅ Task Summary

  • Ask to be assigned to the issue.
  • Implement function compressImage() in Python/ folder.
  • Manually execute the newly implemented function to ensure it works.
  • Submit a pull request in open-runtimes/examples and include screenshots of successful execution.

If you have questions, need any help, or just want to hang out, make sure to join us on our Discord server.

Happy Appwriting!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions