How to show images in a field on a form

Hi,

I have a db which keeps the name, image (only the filename) of people (which I want to display).

e.g of db table data

Rita, rita.jpg
Robi, robin.jpg
Lam, lam.jpg

How do I show up the actual image in the form field? (Images kept in /images)

Thanks for reply!

You can try to apply a link on a linkfield, or use a image/file datatype.

I used the image / file data type, but not working. Does that mean we should have blob in db?

I used the image / file data type, but not working. Does that mean we should have blob in db?

No, you can have separate images. But the path needs to be ok. So if you store the filename then the path to the files needs to be set correctly. I useually do not store images and (pdf) files in the database.

I don’t really understand. Can you please give me an example how you do that using my example of {name} and {image} fields? [My folder is /images]

Under normal circumstance you have an upload field of type image/file which stores the image on a defined location. The reference to the filename is stored in the database, but the download offset is something in the settings. So if you store the image name in the database you need to store the images on a certain location to let SC be able to find the image and display. You just want to upload files but create a reference in the database manually. That’s possible, but you need to be sure that the images are on the right location. Otherwise it will simply not work. Hope this makes things more clear. Upon deployment you need to use the advanced deployment if you need to change the image location offset for your production site. If you have to store docs for your employees you can consider to use the employee id as a subdirectory. You can set that on the field specs if you select it as a image/file type.

Thanks for explaining the CONCEPT clearly. In practice am still failing. Below I give the implementation of the field properties:

DataType = Image (File Name)

Upload Area = No

Subfolder = [] or Subfolder = /images/

[All other properties = default]

PLEASE NOTE TEST DATA IN STORED IN DB TABLE FIELD:

paul.jpg

paul.jpg is kept in C:\Program Files\NetMake\v71\wwwroot\scriptcase\app\zzzTemp [zzzTemp is the project name]

paul.jpg ALSO kept in C:\Program Files\NetMake\v71\wwwroot\scriptcase\app\zzzTemp\images

application launched at: http://localhost:98/scriptcase/app/zzzTemp/form_opportunity/index.php

Picture not showing up!!

Thanks and Sorry to take more of your time…

Just a tip: set upload area to true! Then upload a sample file and see where it goes. Look at what’s stored in the database and locate the file after upload. Then you probely know what you need to do? Then you can disable the upload area. You will still see the uploaded image…

Image/File is broken in v7.

As Image/File is implemented, it is useless as a display mechanism. That’s why there are hundreds of questions in here on displaying images.

If you create an Image/File field, then set it to the value of a valid image, the image will not display until the form reloads.
Since you’re probably setting these from an OnLoad event (I see no other way), the correct image will never be displayed. The image you loaded that field with in the previous OnLoad event will be displayed on a subsequent OnLoad (refresh), so the images will always be out of sync. That is not useful.

You might be able to implement some logic to force a double-reload when you change one of these. If you do this, you’re helping NetMake to not fix the real problem. There must be thousands of people doing that already.