diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-05-09 13:15:59 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-05-09 13:15:59 +0000 |
commit | 0df1cfb94d9f70994e02521c4bd41a73a8cda822 (patch) | |
tree | 7eebd802450c992a7a2c6820eaeb0b479873a2af /views/default/object/image.php | |
parent | f52d481c6ae6c790db4dde27044ea401d0b2b713 (diff) | |
download | elgg-0df1cfb94d9f70994e02521c4bd41a73a8cda822.tar.gz elgg-0df1cfb94d9f70994e02521c4bd41a73a8cda822.tar.bz2 |
now handling Pedro Prez's tagging format
Diffstat (limited to 'views/default/object/image.php')
-rw-r--r-- | views/default/object/image.php | 12 |
1 files changed, 9 insertions, 3 deletions
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,','); |