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
+15
-6
@@ -445,17 +445,26 @@ class DiscordSendSaveImage:
|
||||
# Add image info if available
|
||||
if "message_prefix" in image_info:
|
||||
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
|
||||
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"**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"
|
||||
|
||||
|
||||
# Add the complete info message to the Discord message
|
||||
discord_message += info_message
|
||||
print("Added image information to Discord message")
|
||||
if info_message:
|
||||
discord_message += info_message
|
||||
print("Added image information to Discord message")
|
||||
|
||||
# Add prompts after image info if available (decoupled from image info presence)
|
||||
if "prompt_message" in image_info:
|
||||
|
||||
Reference in New Issue
Block a user