diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-09-29 00:41:35 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-10-03 14:22:34 +0200 |
commit | 9b0b9a0e6082b3375ebdadc651c971671c922ebc (patch) | |
tree | 952f529eb974af6091a6f401b6aca012ddc4005d /application/controllers/file.php | |
parent | 64628978d76c19e946754acc922144aff739b83d (diff) |
Move thumbnail code to dedicated class
This also moves the code from mfile->image_dimension() to the only
place where it was called.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r-- | application/controllers/file.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index e1b43d314..1bdab2c9f 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -316,13 +316,14 @@ class File extends MY_Controller { private function _tooltip_for_image($filedata) { + $this->load->library("imglib"); $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,10 @@ 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); + $this->load->library("imglib"); + $thumb = $CI->imglib->makeThumb($this->mfile->file($filedata["hash"]), $thumb_size, IMAGETYPE_JPEG); if ($thumb === false) { show_error("Failed to generate thumbnail"); |