From 1b3a6b85c156e4777d2aa8205b130984f55dc66d Mon Sep 17 00:00:00 2001 From: Chad Parry Date: Sat, 30 Apr 2011 18:29:34 -0600 Subject: Improve the comment explaining why the data_file extension is important. --- modules/gallery/models/item.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/gallery/models') 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"; -- cgit v1.2.3