SOLVED: Can't display the QRCode generated with qrCreate
Posted: Fri Feb 07, 2020 10:40 pm
Hi team, I'm running the example given on the dictionary for the qrCreate command and it seems to be working fine except that no image is displayed. Not sure what am I doing wrong and any help will be appreciated.
For now I'm on IDE on macOS Mojave 10.14 & LC 9.5.1
My card has on button with mouseUp script and one image named "img1"
The picture below is the result of answer tData
For now I'm on IDE on macOS Mojave 10.14 & LC 9.5.1
My card has on button with mouseUp script and one image named "img1"
Code: Select all
on mouseUp
put "M" into tECC
put 3 into tSize
put "132" into tData
-- example how to use qrCreate with LiveCode server
qrCreate "!", tData, tECC, tSize
put the result into tData
answer tData
if tData begins with "Error" then
put tData
answer "Error:" && tData
else
# line 1 of the result contains some info
# the remaining lines contain the png image data
put line 1 of tData into tInfo
delete line 1 of tData
put "<b>Qr code info</b><br/>" & LF
put "Version: " & item 1 of tInfo & "<br/>" & LF
put "ECC: " & item 2 of tInfo & "<br/>" & LF
put "Mode: " & item 3 of tInfo & "<br/>" & LF
put "Mask: " & item 4 of tInfo & "<br/>" & LF
# show the image
put base64Encode(tData) into tData
replace LF with empty in tData
put "<img src='data:image/png;base64," & tData & "'/><br/>" & LF into img "img1"
end if
end mouseUp