feat: fix missing img logic, try to occult image overflow

This commit is contained in:
2024-07-23 17:37:17 +02:00
parent 04cc9637a8
commit df0eee091c
+7 -3
View File
@@ -91,9 +91,9 @@ for card_data in cards:
flavor_text_type=None, flavor_text_type=None,
) )
# Check if card image really exists # Check if card image really exists
if not Path(card_skin_data.image_path).exists(): if not Path(card_skin_data["image_path"].replace("../../", "")).absolute().exists():
print("Missing image for card id: ", card_data["id"], " , using default image") print("Missing image for card id: ", card_data["id"], " , using default image")
card_skin_data = "../../img/missing.png" card_skin_data["image_path"] = "../../img/missing.png"
# Create a new SVG drawing # Create a new SVG drawing
output_dir = "output/" + all_skin_data["skin_name"] output_dir = "output/" + all_skin_data["skin_name"]
os.makedirs(output_dir, exist_ok=True) os.makedirs(output_dir, exist_ok=True)
@@ -211,12 +211,16 @@ for card_data in cards:
) )
) )
d.append(dw.Rectangle(x=0, y=65, width=x_width, height=200)) # Draw image
d.append(dw.Rectangle(x=1, y=65, width=x_width-2, height=200))
d.append( d.append(
dw.Image( dw.Image(
x=0, y=65, width=x_width, height=200, path=card_skin_data["image_path"] x=0, y=65, width=x_width, height=200, path=card_skin_data["image_path"]
) )
) )
d.append(dw.Rectangle(x=2, y=65-1, width=border_width_x-2, height=200+2))
# d.append(dw.Rectangle(x=0, y=65+1, width=1, height=200+2, fill='white'))
d.append(dw.Rectangle(x=x_width-border_width_x, y=65-1, width=border_width_x-2, height=200+2))
# Draw effects # Draw effects
effects = card_data.get("effects") effects = card_data.get("effects")