I would like to know how to display a photo in a image viewer with a featured action. I create a layer with 3 fields: id, leyenda and filepath. Filepath is the field where I put my photo..
After some playing around, here are 2 issues that might be getting in the way.
While display of an image inside QGIS using the form File widget respects relative paths (if Relative Paths is checked), I don't think an Open action does. So there instead of
[%concat(@project_home || '\\', "filepath" )%]. This will prepend the project home path to the filename to make it fully qualified. (The
'\\'becomes the single backslash used in Windows, of course.)
Shouldn't be the case for .jpg, but you need to have a file association in place in the operating system to be able to automatically open the filenames passed to it. It's possible this is somehow broken on your system.
What's unfortunate is that if the OS doesn't know what to do with the (incomplete or unassociated) filename in the action, no error message is generated, just nothing happens. So to debug such problems, I suggest the following.
A. Copy the contents of
"filepath" (or whatever) for one feature.
B. Open a terminal window (via the Browser or otherwise) in a random directory.
C. Try to execute as a command that one filename, by typing
Ctrl-V to paste what you just copied then another
If it's all good, it should open the file, both this way as well as in your desired QGIS action. If it's not working, you'll hopefully get a meaningful error message this way why it's failing.