diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-19 03:29:53 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-19 03:29:53 +0000 |
commit | c7b2090f0cd68acf7e952a71ba30aa4c9edb6a45 (patch) | |
tree | b0d69dc7c78d05333bd01de1d5c1aebf420aaa9f | |
parent | a197c057c83534b0fa59da692fa63bcd49c16a26 (diff) |
add the mime type column on the item table
-rw-r--r-- | core/helpers/core_installer.php | 1 | ||||
-rw-r--r-- | core/helpers/photo.php | 2 | ||||
-rw-r--r-- | core/models/item.php | 5 |
3 files changed, 3 insertions, 5 deletions
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 680d44a3..44fb0a85 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -45,6 +45,7 @@ class core_installer { `title` char(255) default NULL, `description` char(255) default NULL, `name` char(255) default NULL, + `mime_type` char(255) default NULL, `left` int(9) NOT NULL, `right` int(9) NOT NULL, `parent_id` int(9) NOT NULL, diff --git a/core/helpers/photo.php b/core/helpers/photo.php index 553ffe68..cd02696d 100644 --- a/core/helpers/photo.php +++ b/core/helpers/photo.php @@ -42,6 +42,7 @@ class Photo_Core { throw new Exception("@todo INVALID_IMAGE_FILE"); } + Kohana::log("debug", print_r($image_info, true)); // Force an extension onto the name $pi = pathinfo($name); if (empty($pi["extension"])) { @@ -55,6 +56,7 @@ class Photo_Core { $photo->description = $description; $photo->name = $name; $photo->owner_id = $owner_id; + $photo->mime_type = empty($image_info['mime']) ? "application/unknown" : $image_info['mime']; // Randomize the name if there's a conflict while (ORM::Factory("item") diff --git a/core/models/item.php b/core/models/item.php index 950be499..485975cb 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -175,11 +175,6 @@ class Item_Model extends ORM_MPTT { $real_column = substr($column, 0, strlen($column) - 5); return "<span class=\"gInPlaceEdit gEditField-{$this->id}-{$real_column}\">" . "{$this->$real_column}</span>"; - } else if ($column == "mime_type") { - if ($this->is_album() || ($mime_type = file::mime($this->file_path())) === false) { - $mime_type = "application/unknown"; - } - return $mime_type; } else if ($column == "owner") { // This relationship depends on an outside module, which may not be present so handle // failures gracefully. |