Suggested Data Structure Change for Fast_Gallery

tstermitz - May 31, 2009 - 19:45
Project:Fast Gallery
Version:6.x-4.0-beta5
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Fast_Gallery uses two tables: fast_gallery and fast_gallery_exif. The first keeps track of the file (i.e. photo), and the second stores a small set of exif fields for displaying in captions. The problem is that each exif tag gets its own row, creating a vertical data structure. While this deals with the problem of "we don't know which EXIF tags will be required", it doesn't easily let us integrate photos with other modules, like nodes . I'd suggest changing to a horizontal data structure for each eid (see how the Location Module deals with keeping track of locations and nodes in location_instance).

Here is the data structure I'd suggest:
exif_data_instance {
- eid (primary key)
- gid (link to gallery)
- nid (link to node)
- uid (link to user for permissions)
- title (for easy population of node)
- description (for easy population of node)
- exifdata (in JSON format)
}

You might also want to add lid and pull out latitude and longitude to enable mapping, but the easiest first step, is to get fast_gallery working with nodes.

The JSON format is very easy to read and write from PHP (and Java!), and it is utf8 safe. Fast_Gallery might need a few functions to dump additional tags as desired from the encoded exif data, and let the user choose the tags.

This data structure would allow fast_gallery to keep track of the different modules that might be using the photos so you could easily populate or delete them. For example, to automatically create nodes for all photos in a gallery: load a new node with the title and description, keeping track of the nid in exif_data_instance. Bulk delete

I'm ignoring the problem of having the node display the image because I'm not sure whether you want to involve filefield or imagefield, which would make things more complicated. Keeping It Simple Stupid (KISS) you can leave all the node management in Fast_Gallery and just insert the photo as a link with a DIV and CSS in the node body. Next easiest would be for fast_gallery to create its own nodetype with an image field.

 
 

Drupal is a registered trademark of Dries Buytaert.