mimeType($file_path); // Create thumbnail from image if (in_array($mimeType, $this->availableFormats)) { // Get thumbnail name $thumbnail = "thumbnail-$filename"; // Create intervention image $image = Image::make(Storage::disk('local') ->path($file_path)) ->orientate(); // Resize image $image->resize(512, null, fn ($constraint) => $constraint->aspectRatio())->stream(); // Store thumbnail to disk Storage::put("files/$user_id/$thumbnail", $image); } // Return thumbnail as svg file if ($mimeType === 'image/svg+xml') { return $filename; } return $thumbnail ?? null; } }