diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-04-04 20:20:36 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-04-04 20:20:36 +0000 |
commit | 08fa8b7fd926df80b0f0d7bb4334394c44713b18 (patch) | |
tree | feabce4c799e2b5e820630262189d3aaffd8590c /views | |
parent | 1ca3a630454e1ce752d9cb7b5cb2b84318e60ece (diff) | |
download | elgg-08fa8b7fd926df80b0f0d7bb4334394c44713b18.tar.gz elgg-08fa8b7fd926df80b0f0d7bb4334394c44713b18.tar.bz2 |
displaying photo tags on the image
Diffstat (limited to 'views')
-rw-r--r-- | views/default/object/image.php | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/views/default/object/image.php b/views/default/object/image.php index af4a46b4b..cd3d8fe53 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -12,9 +12,35 @@ $desc = $file->description; $owner = $vars['entity']->getOwnerEntity(); $friendlytime = friendly_time($vars['entity']->time_created); - + $mime = $file->mimetype; - + + +// photo tags +$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') { + $user = get_entity($photo_tag->value); + if ($user) + $phototag_text = $user->name; + else + $phototag_text = "unknown user"; + } + + $photo_tags_json .= '{' . $photo_tag->coords . ',"text":"' . $phototag_text . '"},'; + } + $photo_tags_json = rtrim($photo_tags_json,','); + $photo_tags_json .= ']'; +} + + if (get_context() == "search") { //if this is the search view if (get_input('search_viewtype') == "gallery") { @@ -201,6 +227,7 @@ } // // end of individual image display } + ?> <script type="text/javascript" src="<?= $vars['url'] ?>mod/tidypics/vendors/jquery.imgareaselect-0.7.js"></script> @@ -240,8 +267,7 @@ imgOffset = $(image).offset(); - // hard coded for testing - tags = [{"x1":"10","y1":"10","height":"150","width":"50","text":"George"}, {"x1":"25","y1":"25","height":"70","width":"80","text":"Ed"}]; + tags = <?php echo $photo_tags_json; ?>; $(tags).each(function(){ appendTag(imgOffset, this); |