zuri-training / favicon-gen-team-66

Backend repo for Team-66 Favicon generator
MIT License
1 stars 36 forks source link

Baseline Favicon Logic #65

Closed HAKSOAT closed 2 years ago

HAKSOAT commented 2 years ago

Testing

Install dependencies pip install -r requirements.txt

Create an account for images at: https://thumbsnap.com and set the API Key from the platform as THUMBSNAP_APIKEY in the env file.

Created endpoint takes the following key: values:

{
    "source_url": "image_url", 
    "favicon_size": 512, 
    "crop_points" :   {
        "left": pixel distance from left of image, 
        "top": pixel distance from top of image, 
        "right": pixel distance from left of image, 
        "bottom": pixel distance from top of image
    }
}

Favicon size has a default of 16. Crop point picks a default at the middle of the image and cropping to fit in the minimum size of the image's width or height. The crop points give the user a chance to determine what parts of an image will be used in cropping.

An external image service is used as a proof of concept to create the baseline favicon generator. Under normal circumstances, an object store should be used to handle images.

More work still needs to be done to track the uploaded image by creating an ID and linking it to the user who uploaded it; this requires a proper database setup. Also, the endpoint currently does not have any authorization in place so that needs to be improved upon too.