diff --git a/src/includes/stats.php b/src/includes/stats.php index b4be1d0..1bb267f 100644 --- a/src/includes/stats.php +++ b/src/includes/stats.php @@ -45,14 +45,17 @@ $disk0_free = disk_free_space('/home'); $disk0_used = $disk0_total - $disk0_free; $disk0_usage = round(($disk0_used / $disk0_total) * 100, 1); -// --- Gallery image count --- -// --- Image count from cache/gallery.json --- +// --- Gallery image countjpg --- +// --- Image countjpg from cache/gallery.json --- $jsonFile = __DIR__ . '/../cache/gallery.json'; if (file_exists($jsonFile)) { $gallery = json_decode(file_get_contents($jsonFile), true); - $count = $gallery['count'] ?? 0; + $countjpg = $gallery['countjpg'] ?? 0; + $countraw = $gallery['countraw'] ?? 0; } else { - $count = 0; + // generate the file + $countjpg = 0; + $countraw = 0; } @@ -70,5 +73,6 @@ echo json_encode([ 'disk0' => $disk0_usage, 'disk0_total' => $disk0_total, 'disk0_used' => $disk0_used, - 'images' => $count, + 'imagesjpg' => $countjpg, + 'imagesraw' => $countraw, ]); diff --git a/src/js/home.js b/src/js/home.js index 743efe9..7c045fd 100644 --- a/src/js/home.js +++ b/src/js/home.js @@ -1,7 +1,7 @@ document.addEventListener('page-loaded', e => { if (e.detail.page !== "home") return; - const stats = ['Cpu','Ram','Zram','Swap','Disk','Disk0','Images']; + const stats = ['Cpu','Ram','Zram','Swap','Disk','Disk0','Imagesjpg','Imagesraw']; const elements = {}; const bars = {}; const prev = {}; @@ -32,7 +32,7 @@ document.addEventListener('page-loaded', e => { const numVal = Number(val) || 0; // Animate number - if (key === 'Images') { + if (key === 'Imagesjpg' || key === 'Imagesraw') { // Raw number animateValue(elements[key], prev[key], numVal, 400, false); } else { @@ -55,7 +55,7 @@ document.addEventListener('page-loaded', e => { // Progress bar if (bars[key]) { - let pct = key === 'Images' ? Math.min(numVal / 100 * 100, 100) : numVal; + let pct = key === 'Imagesjpg' || key === 'Imagesraw' ? Math.min(numVal / 100 * 100, 100) : numVal; bars[key].style.width = pct + '%'; } diff --git a/src/pages/home.php b/src/pages/home.php index 188f0b6..07dd091 100644 --- a/src/pages/home.php +++ b/src/pages/home.php @@ -38,14 +38,14 @@
-

Images 🖼️

-

-
+

Images JPG 🖼️

+

+
-

Blank Card ✏️

-

-
+

Images RAW 🖼️

+

+