This repository has been archived on 2025-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
Files
beopen/android-client/modules/handler/info.py
2025-02-10 12:37:33 +00:00

43 lines
1.0 KiB
Python

from PIL import Image
import io
from android.storage import app_storage_path
root_path = app_storage_path()
class profile():
def __init__(self):
pass
def username():
pass
def name(self, first_name=None, last_name=None):
if first_name:
self.first_name
if last_name:
self.last_name
if first_name and last_name:
pass
class image():
def __init__(self, post_id):
self.post_id = post_id
self.path = None
def load(self, image_bytes):
image_formats = ['png', 'jpg']
for form in image_formats:
try:
self.path = root_path + f"data/images/{self.post_id}.{form}"
with Image.open(io.BytesIO(image_bytes)) as recieved:
recieved.save(self.path)
print("saved image")
break
except:
print("cant save image")
self.path = None
def delete(self):
os.remove(self.path)