Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josewebdev2000/py-pic-box
Simple API that receives the HTML Base 64 String for an image and returns a URL for that image in the server
https://github.com/josewebdev2000/py-pic-box
base64 flask image-provider image-upload pillow python vercel vercel-deployment
Last synced: 2 days ago
JSON representation
Simple API that receives the HTML Base 64 String for an image and returns a URL for that image in the server
- Host: GitHub
- URL: https://github.com/josewebdev2000/py-pic-box
- Owner: josewebdev2000
- Created: 2024-03-23T01:41:27.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-25T01:27:17.000Z (8 months ago)
- Last Synced: 2024-03-25T23:21:53.936Z (8 months ago)
- Topics: base64, flask, image-provider, image-upload, pillow, python, vercel, vercel-deployment
- Language: Python
- Homepage: https://py-pic-box.vercel.app/
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Py Pic Box
## Overview
This project is my personal Web API to upload images to an online web server.
Why is this required?
Imagine you are working on a programming project that requires you to share images.
How will you share those images to people that use other computers?
Where will you host those images and access them through code?
Well, I have answered those questions for myself by building this project.
- I will share images to people of other computer by uploading those images online and sharing the url of the image
- I will host them in my own web server that has a web service that gives me back the url for the images I uploaded
## Mechanism
My Web API has three routes:
/upload: Route used to upload images to the server (POST Request Only)
/delete: Route used to delete images to the server (POST Request Only)
- /pics: Route used to show images stored in the web server (GET Request Only)
My Web API takes a JSON string with the following fields for the /upload route:
key: API KEY required to use the API
imgbase64: Base 64 Code that contains the data that describes the image
name: Name the user wants for this image to have
The imgbase64 field expects the HTML Base 64 encoded version for image data that follows the following format:
data:[mediatype];base64,
Example:
data:image/png;base64,{base64 pure code starts from here on}
A successful response for the /upload route will contain this following JSON field:
img_url: URL to the image the user just uploaded through Base 64 Code
My Web API takes a JSON string with the following fields for the /delete route:
key: API KEY required to used the API
imgurl: URL for the image hosted in the web server that is to be deleted
A successful response for the /delete route will contain this following JSON field:
message: A confirmation that contains the old URL of the deleted image which leads to a 404 response
An erroneous response for either the /upload route the /delete route will contain the following JSON field:
error: Description of the error raised
To trigger a successful response from the /pics route:
- Trigger a GET request to
https://py-pic-box.vercel.app/pics/{image-filename}
- Receive the image
## Skills
The following technologies were required to compelte this project
- Python
- Flask
## Copyright