Added xpath method for obtaining image when normal fails

This commit is contained in:
Joan
2023-07-11 12:56:02 +02:00
parent e3d7db2916
commit d99399f6ac
3 changed files with 23 additions and 6 deletions

View File

@@ -43,7 +43,7 @@ def create_image(product_id, price):
try:
product_image = Image.open(f"/app/data/images/products/{product_id}.jpg")
except:
product_image = Image.open(f"/app/data/images/placeholder.jpg")
product_image = Image.open(f"/app/data/images/placeholder.png")
hpercent = (baseheight / float(product_image.size[1]))
wsize = int((float(product_image.size[0]) * float(hpercent)))
if wsize < wlimit: