INNER CODE UNIT · Python
get_image_details
AnsahMohammad/shots-studio · legacy/web/app.py:182
def get_image_details(filename):
img_name = os.path.basename(filename)
image = next((img for img in images if img.filename == img_name), None)
if not image:
return jsonify({"error": "Image not found"}), 404
# Find collections containing this image
image_collections = [c.name for c in collections if image in c.images]
return jsonify(
{
"filename": image.filename,
"path": image.path,
"tags": image.get_tags(),
"collections": image_collections,
}
)