summaryrefslogtreecommitdiffstats
path: root/application/service
diff options
context:
space:
mode:
Diffstat (limited to 'application/service')
-rw-r--r--application/service/files.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/application/service/files.php b/application/service/files.php
index 54b1f85af..746cd1162 100644
--- a/application/service/files.php
+++ b/application/service/files.php
@@ -411,4 +411,32 @@ class files {
return true;
}
+
+ static public function tooltip(array $filedata)
+ {
+ $filesize = format_bytes($filedata["filesize"]);
+ $file = get_instance()->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;
+ }
+
}