INNER CODE UNIT · Python

update_image_collections

AnsahMohammad/shots-studio · legacy/web/app.py:211

def update_image_collections(filename):
    data = request.json
    collection_names = data.get("collections", [])

    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

    # Remove image from all collections first
    for collection in collections:
        if image in collection.images:
            collection.remove_image(image)
            image.collections.remove(collection)

    # Add image to selected collections
    for collection_name in collection_names:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…