Is it better to store scaleable coordinates, instead of physical coordinates from the image?

It looks as though the database currently stores annotations as exact coordinates. That limits the annotation to only working with one version of the image.

eg when we upgraded from D5 to D6, we changed our site's page layout, which meant changing the displayed size of all the images. In that case, annotations would have stopped working.

If instead we stored the coordinates as say percentages, or store X co-ords together with the image width, Y with height, then it would be possible to re-calculate physical coordinates at run-time and display the annotations on any sized version of the image.

Comments

hunvreus’s picture

This is something I am actually implementing for another module I am working on: storing relative coordinates of a marker to ensure whatever is the resolution the marker is still correctly placed.

I am currently putting in place the latest changes that are to be applied to the module before the stable release, but so far I've mainly focused on building a hook for people to customize the notes.

icarus75’s picture

Sounds interesting. Is this marker module available on drupal.org?

Cheers,
Bart.

pkej’s picture

Will such a function work with cropped views of the original? I'm sure that imagecache must store the cropping data for the cropped versions of a photo.

hunvreus’s picture

Status: Active » Postponed (maintainer needs more info)

Not sure how exactly you want to play that one: if you modify the original using imagecache, then how is the module supposed to know you did so? Where would such a resizing/cropping takes place: full view of the node, Views? I need to have an automated way of retrieving the values.

robert.oconnell’s picture

Figure I might cross-link this discussion with the imagecache-capable implementation I posted in http://drupal.org/node/761542. It currently caters to a single-sized imagecache preset, without worrying about the above mentions of cropping and rotations.
That would be quite sophisticated to account for all the actions that imagecache might take upon on image.

StudioARE’s picture

Just following this and I think it would be too much to expect if the module had to work if the image was cropped/rotated/etc.

At #761542: Support Image cache there is a modded version of this module that works with ImageCache, but will only work with one version of the image (say you change the image preset you'd lose the annotations).
If the module stored scalable coordinates we could make Image Annotate work with one image with different ImageCache presets that only scales the image.

Not that I know how this should be done though.. Would this be "just" storing the percentage of the position and calculate where on the image (in pixels) the annotation should be placed? Or maybe storing the position in pixels and calculate where it should be placed if the image size changed?

I'm currently using the modded module in #761542: Support Image cache and I'm hoping support for ImageCache presets (scaling) would be in place!

Looking forward on activity on this issue

StudioARE’s picture

Status: Postponed (maintainer needs more info) » Active

Hopefully this won't be forgotten.