fix(image_node): add section header when only dimensions are displayed
When add_dimensions or resize_to_power_of_2 was enabled but add_date, add_time, and include_format_in_message were all disabled, dimensions would be appended to the Discord message without the "Image Information:" section header. Now checks if dimensions will be added but no other metadata exists, and adds the section header in that case. Fixes issue identified in PR #35 review. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
1e94a69e5f
commit
b8aadd7faa
+13
-4
@@ -446,16 +446,25 @@ class DiscordSendSaveImage:
|
|||||||
if "message_prefix" in image_info:
|
if "message_prefix" in image_info:
|
||||||
info_message = image_info["message_prefix"]
|
info_message = image_info["message_prefix"]
|
||||||
|
|
||||||
|
# Check if we need to add dimensions
|
||||||
|
has_resize_dimensions = "original_dimensions" in image_info and "resized_dimensions" in image_info
|
||||||
|
has_dimensions = "dimensions" in image_info
|
||||||
|
|
||||||
|
# Add section header if dimensions will be added but no other metadata exists
|
||||||
|
if (has_resize_dimensions or has_dimensions) and not info_message:
|
||||||
|
info_message = "\n\n**Image Information:**\n"
|
||||||
|
|
||||||
# Add dimensions info if available
|
# Add dimensions info if available
|
||||||
if "original_dimensions" in image_info and "resized_dimensions" in image_info:
|
if has_resize_dimensions:
|
||||||
info_message += f"**Original Dimensions:** {image_info['original_dimensions']}\n"
|
info_message += f"**Original Dimensions:** {image_info['original_dimensions']}\n"
|
||||||
info_message += f"**Resized Dimensions:** {image_info['resized_dimensions']} (Power of 2)\n"
|
info_message += f"**Resized Dimensions:** {image_info['resized_dimensions']} (Power of 2)\n"
|
||||||
elif "dimensions" in image_info:
|
elif has_dimensions:
|
||||||
info_message += f"**Dimensions:** {image_info['dimensions']}\n"
|
info_message += f"**Dimensions:** {image_info['dimensions']}\n"
|
||||||
|
|
||||||
# Add the complete info message to the Discord message
|
# Add the complete info message to the Discord message
|
||||||
discord_message += info_message
|
if info_message:
|
||||||
print("Added image information to Discord message")
|
discord_message += info_message
|
||||||
|
print("Added image information to Discord message")
|
||||||
|
|
||||||
# Add prompts after image info if available (decoupled from image info presence)
|
# Add prompts after image info if available (decoupled from image info presence)
|
||||||
if "prompt_message" in image_info:
|
if "prompt_message" in image_info:
|
||||||
|
|||||||
Reference in New Issue
Block a user