Gallery2:Modules:imageareas - Gallery Codex
Personal tools


From Gallery Codex

Revision as of 05:06, 3 May 2009 by Labuto (Talk | contribs)

ImageAreas Module

Associate extra data like comments and tags with specific areas of images.



This module will add the ability to select a portion of an image using a JavaScript user interface and then attach certain forms of data like comments or tags to that area of the image.

Here are a few target use cases:

  • As the owner of a photo:
    • Tag people you know in your photos, a la Facebook.
    • Add a comment that points out a specific area of an image, as a sort of advanced caption.
  • As a Gallery user viewing a photo.
    • Tag a person or item in someone else's photo.
    • Comment on a detail in a photo, like you can do on Flickr.
    • Search for photos with a certain tag/person/item in them.
    • Search for photos with multiple tags (i.e. "Find all photos of Bob and me").


No usage information yet. This module is still in development.

Feature Specification

  • Must Have:
    • Select an image area
    • Add a comment to an image area
    • Code follows all Gallery code standards and guidelines
    • Thorough unit tests
    • Integrate with Gallery2 users and privileges system
  • Should Have:
    • Tag an image area
    • Search within comments
    • Search tags
  • May Have:
    • Further integration with Facebook

Database Schema

Currently based on Fotonotes' strategy for storing image annotations.

Field Name Data Type
g2_itemid INTEGER
g2_userid INTEGER
modified DATETIME
boundingbox VARCHAR
content TEXT

Feature Requests

Please see the talk page for this module to request a feature. Acknowledged requested features will be listed in this section.

Development Roadmap

Discuss and determine best design strategy April 21 – May 26 [5 weeks]

In collaboration with the other developers who have put work into this feature and the core Gallery developers, I will decide on the best implementation strategy for this feature. Major questions to address:

  1. Should image region based tagging be written into the existing “tags” module or does it constitute its own separate module? If it is separate, how should the two modules interact?
    Separate ImageAreas module that leverages functionality of existing Comments and Tags modules without requiring that they be aware of its existence.
  2. What is the best storage strategy for the tags to allow for efficient searches and queries?
    Store information about image areas in a map table that associates an image area with a comment or tag, where the latter is stored by its respective module.
  3. Is it worthwhile to support both longer notes and shorter tags?
    Yes. 'Longer notes' would be comments with an area, and 'shorter tags' would be tags with an area. Comments will be the first target feature, and then tags will be worked in.
  4. What are the details that must be considered for proper Gallery integration (user privileges, theming, admin UI, etc.)?
    Module will follow all Gallery coding standards and guidelines, and be fully integrated in the Gallery2 paradigm.

Deliverables for this Phase:

  • Detailed feature specification, prioritized into “must have,” “should have,” and “may have”
  • High level design and implementation strategy
    • Heavily modify and adapt the Fotonotes framework into a module that will provide the desired functionality.
  • Database schema for tag and note storage

Proof-of-concept prototype of FotonotesTM in Gallery2 May 26 – June 2 [1 week]

Fotonotes is an open source standard, specification, and collection of scripts for annotating images that provided the inspiration for Flickr’s implementation of image region based tagging.4 In the first week of coding, I will integrate a simple Fotonotes implementation into Gallery2 that provides the default Fotonotes interface and stores the annotations in JPEG EXIF headers (as Fotonotes does by default). This will provide a basic working prototype up-front that can facilitate discussion as development continues.

Deliverables for this Phase:

  • A basic working implementation of Fotonotes in Gallery2
    • The hacked up prototype is available to play with here: [1].

Database tag storage and preliminary Gallery integration June 2 – June 23 [3 weeks]

Fotonotes claims that it provides “stub code for alternate storage strategies (e.g., database).” Using this code and the database schema from Phase 1, I will modify the prototype from Phase 2 such that tags are stored in a database backend. This will involve modification of the PHP callback code in Fotonotes. In the process of doing this, I will begin to modify the Fotonotes code to conform to Gallery standards, which includes details like style and variable names, but also larger issues like conforming to Gallery’s API calling standards and MVC design.

Deliverables for this Phase:

  • An implementation of the database schema from Phase 1
    • Prototype uses a table called ImageAreasMap that implements the database schema, minus user and datetime storage
  • A modified prototype that stores tags in a database backend
  • Modified Fotonotes code that conforms to Gallery’s standards

Continued Gallery Integration June 23 – July 21 [4 weeks]

In this phase I will begin work on all of the peripheral tasks needed to make this feature work properly with the rest of the Gallery paradigm. This includes writing code for identifying the presence of tags on images in all of the different available views, creating and checking for user privileges, writing an admin interface, and doing anything else that was identified in Phase 1 to properly integrate this new feature into Gallery. At the end this phase I hope to be able to release a beta version of the new feature to the Gallery community for testing and feedback.

Deliverables for this Phase:

  • Tag views for including on different views
  • Integration with user privileges system
  • Admin interface with exposed relevant settings
  • Other integration deliverables to be determined in Phase 1
  • GSoC midterm evaluations (due July 7)
  • Beta Release

Test, Review, Cleanup, Additional Features July 21 – August 11 [3 weeks]

With the bulk of the implementation work done, I will work on getting all of the code well tested and ready for production. This will involve writing unit tests for all code, ensuring they pass, and performing code reviews with other members of the Gallery development community. I will give particular attention to security considerations and potential performance optimizations. If in this Phase I find myself ahead of schedule, I can investigate some of the additional features mentioned in the abstract or ideas that came up during Phase 1 or elsewhere in the process. Incorporating improvements from the code reviews and from user testing and feedback of the Beta Release, I hope to be able to make a Final Release by August 11, 2008, Google’s suggested “pencils down” date.

Deliverables for this Ph == Headline text'''Bold text''

Italic text

[[Image:File:Example.jpg<math>Insert formula here</math>]] == ase:

  • Unit tests for all code
  • Incorporated suggestions from users of the Beta Release
  • Completed code reviews, patched security holes, performance optimizations
  • Final Release