m = self.imageLabel.pixmap()
imageLabel.
setPixmap(QPixmap.
fromImage(image1
)) imageLabel.setScaledContents(True)
imageLabel.
setMaximumSize(QSize(115,
112))
#storing the image into database
query.prepare("INSERT INTO registration1 ( picture) "
"VALUES (?)")
picture1 = imageLabel
query.addBindValue(picture1)
query.exec_()
#query database
print("Calls:")
query.exec_("SELECT id,picture FROM registration1 "
"ORDER by picture")
while query.next():
id = int(query.value(0))
Result_picture = query.value(1)
picture = query.value(4)
print(Result_picture)
imageLabel2.
setPixmap(QPixmap.
fromImage(Result_picture
)) imageLabel2.setScaledContents(True)
imageLabel2.
setMaximumSize(QSize(115,
112)) imageLabel2.show()
imageLabel = QLabel()
m = self.imageLabel.pixmap()
image1= QImage(m)
imageLabel.setPixmap(QPixmap.fromImage(image1))
imageLabel.setScaledContents(True)
imageLabel.setMaximumSize(QSize(115, 112))
#storing the image into database
query = QSqlQuery()
query.prepare("INSERT INTO registration1 ( picture) "
"VALUES (?)")
picture1 = imageLabel
query.addBindValue(picture1)
query.exec_()
QApplication.processEvents()
#query database
print("Calls:")
query.exec_("SELECT id,picture FROM registration1 "
"ORDER by picture")
while query.next():
id = int(query.value(0))
Result_picture = query.value(1)
picture = query.value(4)
print(Result_picture)
imageLabel2 = QLabel()
imageLabel2.setPixmap(QPixmap.fromImage(Result_picture))
imageLabel2.setScaledContents(True)
imageLabel2.setMaximumSize(QSize(115, 112))
imageLabel2.show()
QApplication.processEvents()
To copy to clipboard, switch view to plain text mode
Hello guys, is there a better way to store and retrieve image file from database in pyqt progrmming?
Bookmarks