diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-08-24 11:57:49 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-08-24 11:57:49 +0000 |
commit | 9b3063648c91efe04a96c6c9293e130e6b0b58a0 (patch) | |
tree | 5d6780c3fb4ecca0aa2d16835e1060134aafd8b7 /views | |
parent | ca9a2ca2593903c7fc2b569e4338408143c71609 (diff) | |
download | elgg-9b3063648c91efe04a96c6c9293e130e6b0b58a0.tar.gz elgg-9b3063648c91efe04a96c6c9293e130e6b0b58a0.tar.bz2 |
moving tagging code into TidypicsImage class
Diffstat (limited to 'views')
-rw-r--r-- | views/default/object/image.php | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/views/default/object/image.php b/views/default/object/image.php index 852fea8db..10c89459b 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -20,41 +20,14 @@ ///////////////////////////////////////////////////// // get photo tags from database -$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; - $phototag_link = $vars['url'] . 'search/?tag=' . $phototag_text . '&subtype=image&object=object'; - if ($photo_tag->type === 'user') { - $user = get_entity($photo_tag->value); - if ($user) - $phototag_text = $user->name; - else - $phototag_text = "unknown user"; - - $phototag_link = $vars['url'] . "pg/photos/tagged/" . $photo_tag->value; - } - - // 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 . '"},'; - - // prepare variable arrays for tagging view - $photo_tag_links[$p->id] = array($phototag_text, $phototag_link); + $photo_tags_json = "\"\""; + + $tag_info = $file->getPhotoTags(); + if ($tag_info) { + $photo_tags = $tag_info['raw']; + $photo_tags_json = $tag_info['json']; + $photo_tag_links = $tag_info['links']; } - $photo_tags_json = rtrim($photo_tags_json,','); - $photo_tags_json .= ']'; -} - /******************************************************************** * |