diff --git a/FlaskAPI/.idea/.gitignore b/FlaskAPI/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/FlaskAPI/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/FlaskAPI/.idea/FlaskAPI.iml b/FlaskAPI/.idea/FlaskAPI.iml
deleted file mode 100644
index 15b7777..0000000
--- a/FlaskAPI/.idea/FlaskAPI.iml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/FlaskAPI/.idea/inspectionProfiles/profiles_settings.xml b/FlaskAPI/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/FlaskAPI/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/FlaskAPI/.idea/misc.xml b/FlaskAPI/.idea/misc.xml
deleted file mode 100644
index 4bdfec8..0000000
--- a/FlaskAPI/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/FlaskAPI/.idea/modules.xml b/FlaskAPI/.idea/modules.xml
deleted file mode 100644
index 6fa8fc8..0000000
--- a/FlaskAPI/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/FlaskAPI/.vscode/launch.json b/FlaskAPI/.vscode/launch.json
deleted file mode 100644
index 6a28b4c..0000000
--- a/FlaskAPI/.vscode/launch.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "version": "0.0.1",
- "configurations": [
-
- {
- "name": "Python: Flask",
- "type": "python",
- "request": "launch",
- "module": "flask",
- "env": { "FLASK_APP": "app.py", "FLASK_DEBUG": "1" },
- "args": ["run", "--no-debugger", "--no-reload"],
- "jinja": true,
- "justMyCode": true
- }
-
- ]
-}
diff --git a/FlaskAPI/.vscode/settings.json b/FlaskAPI/.vscode/settings.json
deleted file mode 100644
index e69de29..0000000
diff --git a/FlaskAPI/Dockerfile b/FlaskAPI/Dockerfile
index b6a5924..b2c6275 100644
--- a/FlaskAPI/Dockerfile
+++ b/FlaskAPI/Dockerfile
@@ -1,22 +1,11 @@
-# syntax=docker/dockerfile:1
-
-# Comments are provided throughout this file to help you get started.
-# If you need more help, visit the Dockerfile reference guide at
-# https://docs.docker.com/engine/reference/builder/
-
ARG PYTHON_VERSION=3.10.12
FROM python:${PYTHON_VERSION}-slim as base
-# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
-
-# Keeps Python from buffering stdout and stderr to avoid situations where
-# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
WORKDIR /app
-# Copy the source code into the container.
COPY . .
RUN apt-get update && apt-get install -y imagemagick && apt-get install -y wget && ls
@@ -30,15 +19,10 @@ RUN wget https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png && \
mv big-image.png ./static && \
mv video.mp4 ./static
-# Download dependencies as a separate step to take advantage of Docker's caching.
-# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
-# Leverage a bind mount to requirements.txt to avoid having to copy them into
-# into this layer.
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt
-# Expose the port that the application listens on.
EXPOSE 5000
# Run the application.
diff --git a/FlaskAPI/__pycache__/app.cpython-310.pyc b/FlaskAPI/__pycache__/app.cpython-310.pyc
deleted file mode 100644
index c38168b..0000000
Binary files a/FlaskAPI/__pycache__/app.cpython-310.pyc and /dev/null differ
diff --git a/FlaskAPI/controllers/__pycache__/image.cpython-310.pyc b/FlaskAPI/controllers/__pycache__/image.cpython-310.pyc
deleted file mode 100644
index 7cc4314..0000000
Binary files a/FlaskAPI/controllers/__pycache__/image.cpython-310.pyc and /dev/null differ
diff --git a/FlaskAPI/controllers/__pycache__/status.cpython-310.pyc b/FlaskAPI/controllers/__pycache__/status.cpython-310.pyc
deleted file mode 100644
index 1eb22a4..0000000
Binary files a/FlaskAPI/controllers/__pycache__/status.cpython-310.pyc and /dev/null differ
diff --git a/FlaskAPI/controllers/image.py b/FlaskAPI/controllers/image.py
index 4083088..2a3cad7 100644
--- a/FlaskAPI/controllers/image.py
+++ b/FlaskAPI/controllers/image.py
@@ -38,4 +38,4 @@ def get_big_image():
@image_blueprint.route('/image/save-big-image', methods=['POST'])
def save_image():
- pass
+ image_service.save_image(request.files.get('file'))
diff --git a/FlaskAPI/services/__pycache__/image.cpython-310.pyc b/FlaskAPI/services/__pycache__/image.cpython-310.pyc
deleted file mode 100644
index 1ba3a5e..0000000
Binary files a/FlaskAPI/services/__pycache__/image.cpython-310.pyc and /dev/null differ
diff --git a/FlaskAPI/services/image.py b/FlaskAPI/services/image.py
index 6dea1da..6024378 100644
--- a/FlaskAPI/services/image.py
+++ b/FlaskAPI/services/image.py
@@ -1,8 +1,5 @@
from wand.image import Image
-from static.image_helper import ImageHelper
-
-
def box_blur_image_separable(image, blurred_image, radius_x, radius_y):
pixels = image.get_pixels()
blurred_pixels = blurred_image.get_pixels()
@@ -37,33 +34,23 @@ def save_image(file_stream):
file.write(file_stream.read())
file.close()
-
class ImageService:
def __init__(self):
pass
def box_blur_image(self, img, radius):
- temp_path = 'temp_image.png'
- img.save(temp_path)
-
- with Image(filename=temp_path) as img:
- img.blur(radius, 2)
- blurred_temp_path = 'blurred_temp_image.png'
- img.save(filename='blurred_temp_image.png')
- return blurred_temp_path
-
+ with Image(filename=img) as image:
+ image = image.blur(radius, 0)
+ image = image.blur(0, radius)
+ return image
def get_simple_image(self):
- with ImageHelper.SimpleImage as img:
- img = ImageHelper.SimpleImage
- simple_image = 'simple_image.png'
- img.save(filename='simple_image.png')
- return simple_image
-
+ with open("./static/small-image.png", "rb") as file:
+ return file.read()
def get_big_image(self):
- with ImageHelper.BigImage as img:
- img = ImageHelper.BigImage
- big_image = 'big_image.png'
- img.save(filename='big_image.png')
- return big_image
+ with open("./static/big-image.png", "rb") as file:
+ return file.read()
+
+ def save_image(self, img):
+ save_image(img)
diff --git a/FlaskAPI/static/__pycache__/image_helper.cpython-310.pyc b/FlaskAPI/static/__pycache__/image_helper.cpython-310.pyc
deleted file mode 100644
index f8b5084..0000000
Binary files a/FlaskAPI/static/__pycache__/image_helper.cpython-310.pyc and /dev/null differ
diff --git a/FlaskAPI/static/image_helper.py b/FlaskAPI/static/image_helper.py
index 63aba27..55e9c8f 100644
--- a/FlaskAPI/static/image_helper.py
+++ b/FlaskAPI/static/image_helper.py
@@ -8,10 +8,7 @@ class ImageHelper:
@staticmethod
def load_images():
ImageHelper.SimpleImage = Image(filename="./static/small-image.png")
- #ImageHelper.SimpleImage.save(filename="./static/small-image.png")
ImageHelper.BigImage = Image(filename="./static/big-image.png")
- #ImageHelper.BigImage.save(filename="./static/big-image.png")
- pass
ImageHelper.load_images()
\ No newline at end of file
diff --git a/scripts/init.py b/scripts/init.py
index 871b2e8..6347e80 100644
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -13,5 +13,5 @@ def download_file(url):
return local_filename
def init():
- download_file('https://files.ivanch.me/api/public/dl/Dj0gkp-m/small-image.png')
- download_file('https://files.ivanch.me/api/public/dl/FqHEPM1Q/big-image.png')
\ No newline at end of file
+ download_file('https://files.ivanch.me/api/public/dl/iFuXSNhw/small-image.png')
+ download_file('https://files.ivanch.me/api/public/dl/81Bkht5C/big-image.png')
\ No newline at end of file