SAVE AND LOAD image in Directory
-
Hello
before i wanted to save users pictures in my database
and i searched on web and seen that this work doing database heavy for loading
and this better to save images on Directory and save Image path to Table
and load it From Directory!i write this code for save image but do nothing!
QImage originalPixmap; originalPixmap.save("D:\\Projects\\physiotherapy\\sickpic"+filename);
any body can help me please?
-
the folder tree should exist (QImage will not create folders) and
filename
should contain the extension otherwise you have to provide it as second argument@VRonin
but folder is exist and image doese not save :|
with this code i chek the path:void Medical_Records::createFolderPath() { QDir createfolder("D:\\Projects\\physiotherapy\\sickpic"); if(!createfolder.exists()) { createfolder.mkpath("D:\\Projects\\physiotherapy\\sickpic"); } } vo
-
1: could you try
Q_ASSERT(!originalPixmap.isNull());
(this should cause a "crash" in your application if the image is null)
2: your are missing a/
try also to specify the format:originalPixmap.save("D:/Projects/physiotherapy/sickpic/"+filename,"PNG");
-
thanks:)
with this note:- 2: your are missing a / try also to specify the format: `originalPixmap.save("D:/Projects/physiotherapy/sickpic/"+filename,"PNG");*
Saving Problem Solved
But if i want to write a code to if picture exists show message and with yes/no
if user clicks on the yes overwrite pic
Thanks a lot:)
- 2: your are missing a / try also to specify the format: `originalPixmap.save("D:/Projects/physiotherapy/sickpic/"+filename,"PNG");*