summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Parry <github@chad.parry.org>2011-04-30 18:29:34 -0600
committerChad Parry <github@chad.parry.org>2011-04-30 18:29:34 -0600
commit1b3a6b85c156e4777d2aa8205b130984f55dc66d (patch)
treec151340d4068ff03c423c2deb7bd1982e892374a
parentc3e8c1e3b5e3cb1046acd4c923bb0ae9dbcd603a (diff)
Improve the comment explaining why the data_file extension is important.
-rw-r--r--modules/gallery/models/item.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 22634cbf..81830fb9 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -409,7 +409,11 @@ class Item_Model_Core extends ORM_MPTT {
// keep it around.
$original = ORM::factory("item", $this->id);
- // Preserve the extension of the data file.
+ // Preserve the extension of the data file. Many helpers, (e.g. ImageMagick), assume
+ // the MIME type from the extension. So when we adopt the new data file, it's important
+ // to adopt the new extension. That ensures that the item's extension is always
+ // appropriate for its data. We don't try to preserve the name of the data file, though,
+ // because the name is typically a temporary randomly-generated name.
if (isset($this->data_file)) {
$extension = pathinfo($this->data_file, PATHINFO_EXTENSION);
$new_name = pathinfo($this->name, PATHINFO_FILENAME) . ".$extension";