summaryrefslogtreecommitdiffstats
path: root/application/controllers/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r--application/controllers/file.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 329a0bdf7..b81900af2 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -168,6 +168,7 @@ class File extends MY_Controller {
case "image/png":
case "image/gif":
$filedata["tooltip"] = $this->_tooltip_for_image($filedata);
+ $filedata["orientation"] = libraries\Image::get_exif_orientation($file);
$this->output_cache->add_merge(
array("items" => array($filedata)),
'file/fragments/thumbnail'
@@ -317,12 +318,12 @@ class File extends MY_Controller {
private function _tooltip_for_image($filedata)
{
$filesize = format_bytes($filedata["filesize"]);
- $dimensions = $this->mfile->image_dimension($this->mfile->file($filedata["hash"]));
+ list($width, $height) = getimagesize($this->mfile->file($filedata["hash"]));
$upload_date = date("r", $filedata["date"]);
$tooltip = "${filedata["id"]} - $filesize<br>";
$tooltip .= "$upload_date<br>";
- $tooltip .= "$dimensions - ${filedata["mimetype"]}<br>";
+ $tooltip .= "${width}x${height} - ${filedata["mimetype"]}<br>";
return $tooltip;
}
@@ -514,9 +515,11 @@ class File extends MY_Controller {
$cache_key = $filedata['hash'].'_thumb_'.$thumb_size;
- $thumb = cache_function($cache_key, 100, function() use ($id, $thumb_size){
+ $thumb = cache_function($cache_key, 100, function() use ($filedata, $thumb_size){
$CI =& get_instance();
- $thumb = $CI->mfile->makeThumb($id, $thumb_size, IMAGETYPE_JPEG);
+ $img = new libraries\Image($this->mfile->file($filedata["hash"]));
+ $img->makeThumb($thumb_size, $thumb_size);
+ $thumb = $img->get(IMAGETYPE_JPEG);
if ($thumb === false) {
show_error("Failed to generate thumbnail");
@@ -551,6 +554,7 @@ class File extends MY_Controller {
continue;
}
$query[$key]["tooltip"] = $this->_tooltip_for_image($item);
+ $query[$key]["orientation"] = libraries\Image::get_exif_orientation($this->mfile->file($item["hash"]));
}
$this->data["items"] = $query;