From 0df1cfb94d9f70994e02521c4bd41a73a8cda822 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 9 May 2009 13:15:59 +0000 Subject: now handling Pedro Prez's tagging format --- views/default/object/image.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'views') diff --git a/views/default/object/image.php b/views/default/object/image.php index 3bbee049d..b456fdebc 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -18,13 +18,14 @@ // photo tags $photo_tag_links = array(); -$photo_tags_json = ""; +$photo_tags_json = "\"\""; $photo_tags = get_annotations($file_guid,'object','image','phototag'); if ($photo_tags) { $photo_tags_json = "["; foreach ($photo_tags as $p) { $photo_tag = unserialize($p->value); + $phototag_text = $photo_tag->value; if ($photo_tag->type === 'user') { @@ -35,8 +36,13 @@ if ($photo_tags) { $phototag_text = "unknown user"; } - $photo_tags_json .= '{' . $photo_tag->coords . ',"text":"' . $phototag_text . '","id":"' . $p->id . '"},'; - + // hack to handle format of Pedro Prez's tags - ugh + if (isset($photo_tag->x1)) { + $photo_tag->coords = "\"x1\":\"{$photo_tag->x1}\",\"y1\":\"{$photo_tag->y1}\",\"width\":\"{$photo_tag->width}\",\"height\":\"{$photo_tag->height}\""; + $photo_tags_json .= '{' . $photo_tag->coords . ',"text":"' . $phototag_text . '","id":"' . $p->id . '"},'; + } else + $photo_tags_json .= '{' . $photo_tag->coords . ',"text":"' . $phototag_text . '","id":"' . $p->id . '"},'; + $photo_tag_links[] = array($p->id, $phototag_text); // gave up on associative array for now } $photo_tags_json = rtrim($photo_tags_json,','); -- cgit v1.2.3