Added raw image count

This commit is contained in:
2025-10-29 21:13:52 +00:00
parent 756103e25f
commit f23d7d4790
3 changed files with 18 additions and 14 deletions

View File

@@ -45,14 +45,17 @@ $disk0_free = disk_free_space('/home');
$disk0_used = $disk0_total - $disk0_free; $disk0_used = $disk0_total - $disk0_free;
$disk0_usage = round(($disk0_used / $disk0_total) * 100, 1); $disk0_usage = round(($disk0_used / $disk0_total) * 100, 1);
// --- Gallery image count --- // --- Gallery image countjpg ---
// --- Image count from cache/gallery.json --- // --- Image countjpg from cache/gallery.json ---
$jsonFile = __DIR__ . '/../cache/gallery.json'; $jsonFile = __DIR__ . '/../cache/gallery.json';
if (file_exists($jsonFile)) { if (file_exists($jsonFile)) {
$gallery = json_decode(file_get_contents($jsonFile), true); $gallery = json_decode(file_get_contents($jsonFile), true);
$count = $gallery['count'] ?? 0; $countjpg = $gallery['countjpg'] ?? 0;
$countraw = $gallery['countraw'] ?? 0;
} else { } else {
$count = 0; // generate the file
$countjpg = 0;
$countraw = 0;
} }
@@ -70,5 +73,6 @@ echo json_encode([
'disk0' => $disk0_usage, 'disk0' => $disk0_usage,
'disk0_total' => $disk0_total, 'disk0_total' => $disk0_total,
'disk0_used' => $disk0_used, 'disk0_used' => $disk0_used,
'images' => $count, 'imagesjpg' => $countjpg,
'imagesraw' => $countraw,
]); ]);

View File

@@ -1,7 +1,7 @@
document.addEventListener('page-loaded', e => { document.addEventListener('page-loaded', e => {
if (e.detail.page !== "home") return; 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 elements = {};
const bars = {}; const bars = {};
const prev = {}; const prev = {};
@@ -32,7 +32,7 @@ document.addEventListener('page-loaded', e => {
const numVal = Number(val) || 0; const numVal = Number(val) || 0;
// Animate number // Animate number
if (key === 'Images') { if (key === 'Imagesjpg' || key === 'Imagesraw') {
// Raw number // Raw number
animateValue(elements[key], prev[key], numVal, 400, false); animateValue(elements[key], prev[key], numVal, 400, false);
} else { } else {
@@ -55,7 +55,7 @@ document.addEventListener('page-loaded', e => {
// Progress bar // Progress bar
if (bars[key]) { 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 + '%'; bars[key].style.width = pct + '%';
} }

View File

@@ -38,14 +38,14 @@
<div class="progress-bar"><div id="barDisk0"></div></div> <div class="progress-bar"><div id="barDisk0"></div></div>
</div> </div>
<div class="stat-card"> <div class="stat-card">
<h3>Images 🖼️</h3> <h3>Images JPG 🖼️</h3>
<p id="statImages"></p> <p id="statImagesjpg"></p>
<div class="progress-bar"><div id="barImages"></div></div> <div class="progress-bar"><div id="barImagesjpg"></div></div>
</div> </div>
<div class="stat-card"> <div class="stat-card">
<h3>Blank Card ✏</h3> <h3>Images RAW 🖼</h3>
<p id="statImages"></p> <p id="statImagesraw"></p>
<div class="progress-bar"><div id="barnone"></div></div> <div class="progress-bar"><div id="barImagesraw"></div></div>
</div> </div>
</div> </div>
</section> </section>