From 6a10cda61f651f13d0214cbe4d4dcfa4a59e6369 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Thu, 20 Mar 2025 18:55:00 +0800 Subject: [PATCH] Add recipe metadata handling in image processing - Implemented functionality to append recipe metadata to images during the recipe creation process. - Removed redundant metadata handling from the temporary image processing step, streamlining the image handling logic. - Enhanced the overall image processing workflow for better integration of recipe data. --- py/routes/recipe_routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/py/routes/recipe_routes.py b/py/routes/recipe_routes.py index 0761e40b..0373d681 100644 --- a/py/routes/recipe_routes.py +++ b/py/routes/recipe_routes.py @@ -423,6 +423,9 @@ class RecipeRoutes: with open(image_path, 'wb') as f: f.write(optimized_image) + # Add recipe metadata to the image + ExifUtils.append_recipe_metadata(image_path, recipe_data) + # Create the recipe JSON current_time = time.time() @@ -643,9 +646,7 @@ class RecipeRoutes: # Copy the original image to temp file shutil.copy2(image_path, temp_path) - - # Add recipe metadata to the image - processed_path = ExifUtils.append_recipe_metadata(temp_path, recipe) + processed_path = temp_path # Create a URL for the processed image # Use a timestamp to prevent caching