From e9950a12aa522efdec9233c5a02c0d4148063687 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Mon, 16 Apr 2012 17:38:32 -0400 Subject: [PATCH] Display file size and resolution for photos and movies. --- 3.0/modules/rwinfo/helpers/rwinfo_block.php | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/3.0/modules/rwinfo/helpers/rwinfo_block.php b/3.0/modules/rwinfo/helpers/rwinfo_block.php index 5627ae03..a5de83ef 100644 --- a/3.0/modules/rwinfo/helpers/rwinfo_block.php +++ b/3.0/modules/rwinfo/helpers/rwinfo_block.php @@ -72,6 +72,28 @@ class rwinfo_block_Core { } // rWatcher Edit: + if (!$theme->item->is_album()) { + // Calculate file size. + $filesize_unit = array("B","kB","MB","GB","TB","PB","EB","ZB","YB"); + $item_filesize = filesize($theme->item->file_path()); + $unit_counter = 0; + while ($item_filesize > 1024) { + $item_filesize = $item_filesize / 1024; + $unit_counter++; + } + $item_filesize = number_format($item_filesize, 2) . " " . $filesize_unit[$unit_counter]; + $info["file_size"] = array( + "label" => t("File size:"), + "value" => $item_filesize + ); + + // Display photo/video resolution. + $info["file_resolution"] = array( + "label" => t("Resolution:"), + "value" => $theme->item->width . " x " . $theme->item->height . " " . t("pixels") + ); + } + //if ($theme->item->captured && module::get_var("rwinfo", "show_captured")) { // $info["captured"] = array( // "label" => t("Captured:"),