Is it possible to set up a field as a file/image browser with images?

Is it possible to set up a field as a file/image browser with images?

rmeetinrmeetin Posts: 97Questions: 23Answers: 1

This ought to be fun.

In my table/form I have a field for background_color. To take this to the next level it would be great to have a field for background_image. This field is not an uploader. Images are added by ftp. What it would do is use something like opendir to probe for images in a specified folder. Each image has a thumbnail. When you click to enter the field it would display the thumbs as a list or grid (with a NULL option). You select and the filename (no need for path) becomes the field entry.

Tx

Answers

  • rmeetinrmeetin Posts: 97Questions: 23Answers: 1

    To visualize the idea think of it like a date-picker, but thumbs and not dates.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    The datatable field type will get you a long way to what you are looking for. It would be a DataTable display rather than a more traditional gallery, but that might be okay as you can show the file name and other meta information as well as a thumbnail.

    Consider this example - note that the DataTable in the Editor form contains Ajax loaded data. You aren't interested in the child editing aspect, but it shows that all important Ajax loaded data. You would point that Ajax call to a PHP file which does a opendir and scans over the files available, returning JSON with that information. Then set the optionsPair.value to match the value you want to store in the database (file name probably) and job done :)

    Allan

Sign In or Register to comment.