@props([ 'src' => null, // Đường dẫn file trong storage/public 'alt' => '', // Mô tả ảnh 'width' => 1200, // Chiều rộng mặc định 'height' => null, // Chiều cao (có thể null) 'fit' => 'cover', // contain | cover | fill 'format' => 'webp', // webp | jpg | png 'quality' => 80, // Chất lượng ảnh ]) @php if ($src) { $baseUrl = route('image.glide.show', ['path' => $src]); $makeUrl = function ($w, $h = null) use ($baseUrl, $fit, $format, $quality) { $params = array_filter([ 'w' => $w, 'h' => $h, 'fit' => $fit, 'fm' => $format, 'q' => $quality, ]); return $baseUrl . '?' . http_build_query($params); }; } @endphp @if ($src) {{-- Mobile --}} {{-- Tablet --}} {{-- Desktop --}} {{ $alt }} @endif