| |
Posté le 07 mars 2018 - 01:53 |
i have been running into a wall here. i have created a window for my android app to take pictures. i would like the picture to not save permanently to the android filesystem or gallery.
once i click on my "capture button", i would like the image to be added as what i can assume from reading all over this forum and others to use a binary memo, using the HLinkMemo function.
however i am not exactly sure on what to do. i have read through the HLinkMemo help page on doc.windev.com but nothing i do seems to be working.
i have tried a very basic approach of creating a temp image then pushing it to the local android database.
img_photo1 is Image = VideoCapture(CAM_Camera,"temp_image",viPictureCapture) IF HLinkMemo(BinFile,bin_data,"temp_image",hMemoImg) = True THEN Info("Success!") END ELSE Info("Failed!") END
anytime i try to use the HAdd function i get returned with an error of "Unable to open the <!s!> file and the app crashes.
i am still kinda new to this and this is the only function of my andriod app that is not working as intended.
Any suggestions? i have read through the HLinkMemo help on doc.windev.com |
| |
| |
| | | |
|
| | |
| |
Posté le 07 mars 2018 - 09:20 |
Elisha,
maybe you need to specify the PATH as well and not just "temp_image"? |
| |
| |
| | | |
|
| | |
| |
Posté le 07 mars 2018 - 12:39 |
EDITED
This should work:
STPhoto is Structure sPath is string bFromData is boolean END
sBRespic is string = ""
sPhoto = VideoStartApp(viPictureCapture)
IF sPhoto <> “” THEN
sBRespic = stPhoto.sPath
HReset(App_Photos)
IF HLinkMemo(App_Photos, jobphoto, sBRespic, hMemoImg) = False THEN Error("Unable to Add the Photo: " + sPhoto, ErrorInfo()) RESULT False END
App_Photos.dateadded = DateSys()+TimeSys() App_Photos.jobphotoname = job_table.'Job No' + "_" + pictime+".jpg" App_Photos.StaffId = gnTHEUSERID HAdd(App_Photos)
RESULT True
END
RESULT False
END |
| |
| |
| | | |
|
| | |
| |
Posté le 13 mars 2018 - 08:19 |
Thank You for helping me out.
However i am running into some issues.
i tried doing a copy paste of your code for testing and it throws back a bunch of errors.
first one it hits me with is the very beginning. STPhoto is Structure sPath is string bFromData is boolean END gives me an error of " Error:A structure cannot be declared outside the declaration code of the global variables in this version of Android generator"
what am i doing wrong? |
| |
| |
| | | |
|
| | |
| |
Posté le 13 mars 2018 - 10:12 |
Hi,
Sorry, ive just tried to remove lots from mine that you dont need.
//**this should be in your Project Initializing code**
STPhoto is Structure sPath is string bFromData is boolean END
// **this should be in your button click**
sBRespic is string = ""
sPhoto = VideoStartApp(viPictureCapture)
IF sPhoto <> “” THEN
sBRespic = stPhoto.sPath
//**obviously App_Photos is my datafile and will need changing to yours**
HReset(App_Photos)
IF HLinkMemo(App_Photos, jobphoto, sBRespic, hMemoImg) = False THEN Error("Unable to Add the Photo: " + sPhoto, ErrorInfo()) RETURN END
App_Photos.dateadded = DateSys()+TimeSys() App_Photos.jobphotoname = job_table.'Job No' + "_" + pictime+".jpg" App_Photos.StaffId = gnTHEUSERID
IF HAdd(App_Photos) = TRUE THEN fDelete(sBRespic ) END
END |
| |
| |
| | | |
|
| | |
| |
Posté le 13 mars 2018 - 22:31 |
Awesome, thank you again.
i had tried putting that first part in my init code as it was the path the error was kinda leading me on. but i was getting the same error as below, i thought i was doing it wrong, probably still am...
i placed it there and an error is generated. Error:'stPhoto' is a structure: it cannot be used directly. Declare a 'stPhoto' variable.
i also get an error on the sPhoto Error:The identifier 'sPhoto' is unknown or inaccessible. |
| |
| |
| | | |
|
| | |
| |
Posté le 13 mars 2018 - 22:55 |
Hi
try to declare:
sPhoto is image
ps read help in windev website is more handy indeed.
HTH
King |
| |
| |
| | | |
|
| | |
| |
Posté le 14 mars 2018 - 11:02 |
Sorry Elisha you only need the below code forget the structure, i was trying to remove bits from mine you dont need and made a bit of a mess of it
// **this should be in your button click**
sPhoto is string
sPhoto = VideoStartApp(viPictureCapture)
IF sPhoto <> “” THEN
//**obviously App_Photos is my datafile and will need changing to yours**
HReset(App_Photos)
IF HLinkMemo(App_Photos, jobphoto, sPhoto, hMemoImg) = False THEN Error("Unable to Add the Photo: " + sPhoto, ErrorInfo()) RETURN END
IF HAdd(App_Photos) = TRUE THEN fDelete(sPhoto) END
END |
| |
| |
| | | |
|
| | |
| |
Posté le 15 mars 2018 - 05:46 |
Awesome! you have been a great help to me, and i thank you. |
| |
| |
| | | |
|
| | |
| |
Posté le 15 mars 2018 - 21:32 |
I do have a followup question,
is it possible to take that binary memo stored on my android device, and upload it to a MSSQL DB varbinary(max) field?
i have been reading on the doc.windev.com site to use the keyword WDBinaryMemo in my insert query, but it does not seem to work.
i have tried both sBinTest1 is string = "INSERT INTO BinFile(bin_data) VALUES ({wdbinarymemo('temp_img.jpg')})"
and sbintst = HExtractMemo(BinFile,bin_data,"temp_img.jpg") sBinTest1 is string = "INSERT INTO BinFile(bin_data) VALUES ({wdbinarymemo("+sbintst+")})" |
| |
| |
| | | |
|
| | |