feat: fix missing img logic, try to occult image overflow
This commit is contained in:
@@ -91,9 +91,9 @@ for card_data in cards:
|
||||
flavor_text_type=None,
|
||||
)
|
||||
# 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")
|
||||
card_skin_data = "../../img/missing.png"
|
||||
card_skin_data["image_path"] = "../../img/missing.png"
|
||||
# Create a new SVG drawing
|
||||
output_dir = "output/" + all_skin_data["skin_name"]
|
||||
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(
|
||||
dw.Image(
|
||||
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
|
||||
effects = card_data.get("effects")
|
||||
|
||||
Reference in New Issue
Block a user