aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-05-09 13:15:59 +0000
committerCash Costello <cash.costello@gmail.com>2009-05-09 13:15:59 +0000
commit0df1cfb94d9f70994e02521c4bd41a73a8cda822 (patch)
tree7eebd802450c992a7a2c6820eaeb0b479873a2af
parentf52d481c6ae6c790db4dde27044ea401d0b2b713 (diff)
downloadelgg-0df1cfb94d9f70994e02521c4bd41a73a8cda822.tar.gz
elgg-0df1cfb94d9f70994e02521c4bd41a73a8cda822.tar.bz2
now handling Pedro Prez's tagging format
-rw-r--r--views/default/object/image.php12
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,',');