exists($imagePath)) { return null; } // Erstelle die URL $url = \Storage::disk('public')->url($imagePath); // Stelle sicher, dass HTTPS verwendet wird if (strpos($url, 'http://') === 0) { $url = str_replace('http://', 'https://', $url); } return $url; } public static function getImageUrlOrPlaceholder($imagePath, $size = '400x400') { $url = self::getImageUrl($imagePath); if ($url) { return $url; } // Fallback zu einem Placeholder-Bild return "https://via.placeholder.com/{$size}/cccccc/666666?text=Kein+Bild"; } } // In der View verwenden: // {{ \App\Helpers\ImageHelper::getImageUrlOrPlaceholder($nailPolish->image_path) }} // Oder als Blade-Directive in AppServiceProvider.php registrieren: /* public function boot() { Blade::directive('nailPolishImage', function ($expression) { return ""; }); } */ // Dann in der View: // @nailPolishImage($nailPolish->image_path) ?>