View an image in custom code with api/jupload

I have a table “images” with ImageID and ImageFile (upload to folder).

In a custom file I need to show the images in that table, so I need some code to generate the image src attribute with the api call, something like:

https://mysite.com/api/jupload?id=x_ImageFile&table=images&session=CUUzgIzc3d0mUrSjVc_BCJAvoEnbirGk3cZ717R-eInSY6sJeXBhWA&x_ImageFile=demo1.jpg&version=thumbnail&download=1

What’s the right way to manage this?

Use the file API