summaryrefslogtreecommitdiff
path: root/modules/tag
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tag')
-rw-r--r--modules/tag/helpers/tag.php30
-rw-r--r--modules/tag/helpers/tag_event.php50
-rw-r--r--modules/tag/hooks/photo_created.php2
3 files changed, 50 insertions, 32 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 19e2238e..774e1fa1 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -88,34 +88,4 @@ class tag_Core {
$form->add_rules_from(ORM::factory("tag"));
return $form;
}
-
- /**
- * Handle the creation of a new photo.
- * @todo Get tags from the XMP and/or IPTC data in the image
- *
- * @param Item_Model $photo
- */
- public static function on_photo_create() {
- $photo = Event::$data;
- $path = $photo->file_path();
- $tags = array();
- $size = getimagesize($photo->file_path(), $info);
- if (is_array($info) && !empty($info["APP13"])) {
- $iptc = iptcparse($info["APP13"]);
- if (!empty($iptc["2#025"])) {
- foreach($iptc["2#025"] as $tag) {
- $tags[$tag]= 1;
- }
- }
- }
-
- // @todo figure out how to read the keywords from xmp
-
- foreach(array_keys($tags) as $tag) {
- self::add($photo, $tag);
- }
-
- return;
- }
-
}
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
new file mode 100644
index 00000000..25a79c2a
--- /dev/null
+++ b/modules/tag/helpers/tag_event.php
@@ -0,0 +1,50 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class tag_event_Core {
+ /**
+ * Handle the creation of a new photo.
+ * @todo Get tags from the XMP and/or IPTC data in the image
+ *
+ * @param Item_Model $photo
+ */
+ public static function photo_create($photo) {
+ print "PHOTO CREATE";
+
+ $path = $photo->file_path();
+ $tags = array();
+ $size = getimagesize($photo->file_path(), $info);
+ if (is_array($info) && !empty($info["APP13"])) {
+ $iptc = iptcparse($info["APP13"]);
+ if (!empty($iptc["2#025"])) {
+ foreach($iptc["2#025"] as $tag) {
+ $tags[$tag]= 1;
+ }
+ }
+ }
+
+ // @todo figure out how to read the keywords from xmp
+
+ foreach(array_keys($tags) as $tag) {
+ self::add($photo, $tag);
+ }
+
+ return;
+ }
+}
diff --git a/modules/tag/hooks/photo_created.php b/modules/tag/hooks/photo_created.php
deleted file mode 100644
index 8d033317..00000000
--- a/modules/tag/hooks/photo_created.php
+++ /dev/null
@@ -1,2 +0,0 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-Event::add("gallery.photo.created", array('tag', 'on_photo_create'));