Skip to content

Latest commit

 

History

History
80 lines (60 loc) · 1.26 KB

README.md

File metadata and controls

80 lines (60 loc) · 1.26 KB

Thumbnail API

Images API.

Demo

LINK TO DEMO admin - admin

Techstack

  • Django
  • Django Rest Framework
  • AWS S3
  • AWS CloudFront
  • PostgreSQL

Prerequisites

Local Development

Create own .env

cp .env.example .env

Start the dev server for local development:

docker compose up

Run a command inside the docker container:

docker compose run --rm web [command]

List images

List all users images include thumbnails.

GET /api/v1/images/

Upload image

Upload image file.

POST /api/v1/images/upload/

Example response:

{
    "id": "a21cb51c-555e-4cc3-8548-74845e386ff5",
    "created_at": "2023-03-10T15:12:43+0000",
    "updated_at": "2023-03-10T15:12:43+0000",
    "urls_dict": [
        {
            "200x200": "127.0.0.1/<user_id>/<uui4>.jpg"
        },
        {
            "orginal": "127.0.0.1/<user_id>/<uui4>.jpg"
        }
    ]
}

Generate expiring link

Generate temporary link to uploaded image using url.

POST /api/v1/images/generate_expiring_link/

Example POST:

url - link to thumbnail

time - time in second to expire

{
"url": "http://127.0.0.1:8000/<user_id>/<image_name>",
"time": 300
}