Q:
In the mobile app that I’m building the user should be able to upload pictures (either from the camera or file storage) to be stored in a table similar to how in the Southwind database the Employees have their pictures stored. I think I understand how to get that picture in my mobile app, but once I do how do I go about uploading it to my cloud server?
A:
It is data bound. Just touch the picture and you can choose to take a photo or select an existing one. It is uploaded automatically for you and either inserted or updated in the table it is bound too.
Q2:
The user clicks a button and gets the file or camera choice then takes a photo/chooses a file which then gets uploaded to the table on my server. I can do the first part currently using Lianja.getPicture() in my click delegate. I just don’t know how to go from there to having the file uploaded and stored in my table. I’m guessing I can do something in the onSuccess callback, just not sure how to do it.
A2:
If you want to do it that way there is more involved as you need to manually upload and call a server side rsp page to handle the decoding of the image and then store it in a table.
Data binding does that for you. If you have an “upload page” with an image preview above the button would that work for your use case?
Q:
custom section, I have an image class that uses mousewheel.
I can see Lianja is picking up the mousewheel move, but I am not sure how to capture which way the mouse wheel was moved.
A:
If you have a procedure in the class to handle the mousemove it is passed 4 parameters
Code:
// nButtonNumber left=1, right=2, middle=4
// nModifiers shift=1, control=2, alt=4 none=0 (can be added together)
proc mouseMove(nButtonNumber, nModifiers, nXpos, nYpos)
endproc
The mousePress and mouseRelease event handlers are called with the same 4 parameters.
So you need to handle the press and release to keep track of where the mouse was at the start and end of the move operation.
You can keep the last known mouse x and y position starting in the mousePress event handler and updating it in the mouseMove event handler. By comparing the current position to the last position you can determine direction of movement and delta.
A2:
The mouseWheel() event handler takes the same last 3 parameters as mousePress(), mouseRelease() and mouseMove(). The first parameter is the delta movement which can be positive or negative.
Q:
I have several items that I need to have the user move around on the screen.
To make this quick, I allow different keystrokes for the different items.
Is it possible to use something like “on key label ctrl+leftArrow mytext.left = mytext.left -2”
These are images that I need to move side-by-side (and sometimes overlay).
In the application that I am replacing, I use different keystrokes to change the focus between images and then the arrow keys to move them.
This would be in either a custom VFP section or a Canvas VFP section.
A:
An image In a custom section the KEYPRESS event handler is called with 2 args:
Code:
proc mykeypress(keycode as numeric, keymodifiers as numeric)
// your code here
endproc
Q:
I am trying to explore different possibilities of using the webview with images.
I have millions of images across my servers, so keeping them in a single application directory is not going to work.
I would like to be able to display specific images in the webview.
Looking at thebase64_encode_image(object_fieldname [,width,height [,cssattr ]]) documentation,
I would like to specify the full network path of the file, have it written as temp file (as if it came from a database) and display it the webview.
It looks possible, (with include file – I think) but I can’t get it working properly.
A:
I would suggest you look at using the getfile() method in the networkrequest class to fetch the image into a temporary file which you can then process and if needed send back with putfile() in the same class.
http://www.lianja.com/doc/index.php/NetworkRequest
base64_encode_image is meant to work off binary memo (blob) fields.
base64_encode_file has the same parameters and output except that it takes a file reference as the first parameter.
Interesting decision to make: store all those images in a (very large) table or put them in a maze of directories. Because of the ability to store metadata about the image with (or attached to via relations) the image, and the ability to move the database easily to a different infrastructure, I would favor a table. Having been burned by backup routines and tables, I would have the files also stored in a different physical location as files on a network. <s> A Lianja database installed on its own instance would be very useful here because of the ability to SEEK a single record (nothing is faster than a SEEK — use a stored procedure to find the record and return the base64-encoded result) and the ability to tune (using smartquery) that instance of the LSS for handling images.
I just pointed a web url at the root folder of the images and that is doing just what I need.
Q:
Is possible to show a picture in a grid section?
If not, is possible to have more than one link in the catalog view?
If not, is possible to insert picture in a webview section?
A:
Look at the grid column attributes. And yes of course a webview (section or gadget) can display an image, that’s exactly what the catalog view does and the source code is in the library for you to study.
A2:
Here is an easy way to display your image in a grid.
use the employees table in southwind.
Add a new grid.
Add Firstname, Lastname and photograph (which is an image in the table).
Then in the section attributes, select “show memo/object panel”
Then click “split edit“
If you want to hide the column Photograph, set “visible when” 1=2.
Q2:
I need all the picture in the grid.. like this
A:
this code work fine!
Code:
proc myPictureContainer
mycontainer = createobject("container")
mycontainer.layout = "horizontal"
mycontainer.height = 50
mycontainer.addobject("image1","image")
image1.picture = keylookup("Giocatori", "GIOCATORE", azioni.giocatore, mline(fotopath, 1))
image1.Stretch = 1
return mycontainer
OpenCv is the Gold standard of image processing.
C++ and python are the languages mostly used for this.
Lianja makes it exceedingly simple to build robust image applications that are database aware.
I would argue that there is not a better platform than Lianja to quickly build image recognition, image processing, image tracking etc.
With it’s support for python, you can build image apps faster than in any platform.
And for those of you not familiar with Version 3.0, you can see some of incredible IDE improvements.
https://www.youtube.com/watch?v=bF1096tC8pk