summaryrefslogtreecommitdiffstats
path: root/application/controllers/file/file_default.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-09-02 00:46:18 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-09-19 21:41:30 +0200
commita703f4987c69670f0d4007624d3dd61ef27bccb0 (patch)
tree5ab9452c158fcde74c74b73ac6d7a17241e8922f /application/controllers/file/file_default.php
parentc199a758635f04c193b812052186fe19366f4f2e (diff)
Extract tooltip function into \service\files
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/file/file_default.php')
-rw-r--r--application/controllers/file/file_default.php30
1 files changed, 2 insertions, 28 deletions
diff --git a/application/controllers/file/file_default.php b/application/controllers/file/file_default.php
index 8d1f67636..2a16521a1 100644
--- a/application/controllers/file/file_default.php
+++ b/application/controllers/file/file_default.php
@@ -216,7 +216,7 @@ class File_default extends MY_Controller {
$base = explode("/", $filedata["mimetype"])[0];
if (\libraries\Image::type_supported($mimetype)) {
- $filedata["tooltip"] = $this->_tooltip_for_image($filedata);
+ $filedata["tooltip"] = \service\files::tooltip($filedata);
$filedata["orientation"] = libraries\Image::get_exif_orientation($file);
$output_cache->add_merge(
array("items" => array($filedata)),
@@ -378,32 +378,6 @@ class File_default extends MY_Controller {
$output_cache->render_now($data, $this->var->view_dir.'/html_paste_footer');
}
- private function _tooltip_for_image($filedata)
- {
- $filesize = format_bytes($filedata["filesize"]);
- $file = $this->mfile->file($filedata["data_id"]);
- $upload_date = date("r", $filedata["date"]);
-
- $height = 0;
- $width = 0;
- try {
- list($width, $height) = getimagesize($file);
- } catch (\ErrorException $e) {
- // likely unsupported filetype
- }
-
- $tooltip = "${filedata["id"]} - $filesize<br>";
- $tooltip .= "$upload_date<br>";
-
-
- if ($height > 0 && $width > 0) {
- $tooltip .= "${width}x${height} - ${filedata["mimetype"]}<br>";
- } else {
- $tooltip .= "${filedata["mimetype"]}<br>";
- }
-
- return $tooltip;
- }
private function _display_info($id)
{
@@ -699,7 +673,7 @@ class File_default extends MY_Controller {
unset($query[$key]);
continue;
}
- $query[$key]["tooltip"] = $this->_tooltip_for_image($item);
+ $query[$key]["tooltip"] = \service\files::tooltip($item);
$query[$key]["orientation"] = libraries\Image::get_exif_orientation($this->mfile->file($item["data_id"]));
}