Hi. For my website, I'm developing a script that scrapes some website to insert product on my shop. For stuff like dimensions, names, descriptions and so on, it's all fine, but when I insert (into File System, firstly, and into the DB, later) the images, I see them in the backend but not in the previews of the products, even if I do the thumbnail refresh. This is the relevant Python code:
try:
sql = "INSERT INTO psz1_image (id_product, position, cover) VALUES (%i, %i, %s);" % (
pid, i, "1" if i == 1 else "NULL")
cur.execute(sql)
except IntegrityError:
pass
conn.commit()
try:
sql = "SELECT id_image FROM psz1_image ORDER BY id_image DESC LIMIT 1;"
cur.execute(sql)
img_id = str(cur.fetchone()[0])
sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 1)
cur.execute(sql)
conn.commit()
sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 2)
cur.execute(sql)
conn.commit()
sql = "INSERT INTO psz1_image_lang (id_image, id_lang, legend) VALUES (%s, %i, '');" % (img_id, 3)
cur.execute(sql)
conn.commit()
except:
pass
How could I solve the problem and see the images on the website? Thank you in advance.