@props([ $get_size = $size ?? '_medium' , $image_width = $w ?? null , ]) @php use Illuminate\Support\Facades\File; // Setup default values $imagePath = $info->path_link ?? $setting->placeholder; $imageFullPath = public_path($imagePath); $finalSrc = asset($imagePath); $placeholder = asset($setting->placeholder); $finalAlt = $info->title ?? 'সংবাদ ছবি'; $finalTitle = $info->title ?? $finalAlt; $classList = 'img-fluid lazyload ' . ($class ?? ''); // Default aspect ratio $aspectRatio = '16/9'; // Calculate real aspect ratio if file exists if (File::exists($imageFullPath)) { [$width, $height] = getimagesize($imageFullPath); if ($width > 0 && $height > 0) { $gcd = function ($a, $b) use (&$gcd) { return ($b == 0) ? $a : $gcd($b, $a % $b); }; $divisor = $gcd($width, $height); $aspectRatio = ($width / $divisor) . '/' . ($height / $divisor); } } @endphp {{ $finalAlt }}