@php $totalFiles = 0; $totalBytes = 0; $optimizedBytes = 0; $savedBytes = 0; $savings = 0; if (!empty($globalStats)) { $totalFiles = $globalStats['totalOptimized']; $totalBytes = $globalStats['totalBytes']; $optimizedBytes = $globalStats['optimizedBytes']; $savedBytes = $globalStats['savedBytes']; $savings = ($totalBytes == 0) ? 0 : ($savedBytes / $totalBytes); } /** @var \MediaCloud\Plugin\Tools\Optimizer\OptimizerAccountStatus $accountStatus */ if (!empty($accountStatus)) { $progress = ($accountStatus->quota() == 0) ? 0 : min(1.0, $accountStatus->used() / $accountStatus->quota()); $pcolor = "#7ED321"; if (($progress > 0.33) && ($progress < 0.66)) { $pcolor = "#F5A623"; } else if ($progress >= 0.66) { $pcolor = "#D0021B"; } if ($accountStatus->quotaType() === \MediaCloud\Plugin\Tools\Optimizer\OptimizerConsts::QUOTA_API_CALLS) { if ($progress < 1.0) { $quotaLabel = sprintf('%.0f', $progress * 100).'%'; } else { $quotaLabel = 'Over Quota'; } } else { $remaining = max(0, $accountStatus->quota() - $accountStatus->used()); if ($remaining > 0) { $quotaLabel = size_format($remaining)."
Remaining"; } else { $quotaLabel = 'Over Quota'; } } } @endphp

Savings

@include('base.ui.circle-graph', ['progress' => $savings, 'circleWidth' => 65])
{{sprintf('%.0f', $savings * 100)}}%
@if(!empty($accountStatus))

Account Quota

@include('base.ui.circle-graph', ['progress' => $progress, 'circleWidth' => 65, 'progressColor' => $pcolor])
{!! $quotaLabel !!}
@endif
Overall, you have optimized {{size_format($totalBytes,2)}} of images ({{$totalFiles}} files) saving {{size_format($savedBytes, 2)}} ({{sprintf('%.0f', $savings * 100)}}%) total file size.