Skip to content

Commit

Permalink
Fix exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Mythos committed Apr 22, 2024
1 parent 2770c7e commit a0d6717
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Helpers/ImageHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ImageHelpers

private const IMAGE_SFW_FILENAME = 'image_sfw';

public static function getImage($url, $width): ?EncodedImage
public static function getImage($url, $width = 400): ?EncodedImage
{
$outputType = config('images.type');
$image = static::downloadImage($url, $width);
Expand Down Expand Up @@ -150,7 +150,7 @@ public static function createAndSaveArticleImage($url, $path): void
ImageHelpers::storePublicImage($image, $path . '/image.' . config('images.type'), false);
}

private static function downloadImage($url, $width): ?ImageInterface
private static function downloadImage($url, $width = 400): ?ImageInterface
{
if (empty($url)) {
return null;
Expand All @@ -163,7 +163,7 @@ private static function downloadImage($url, $width): ?ImageInterface
}
$image = $response->body();
$image = $manager->read($image);
$image = $image->scaleDown(width: $width ?? 400);
$image = $image->scaleDown(width: $width);

return $image;
} catch (Exception $exception) {
Expand Down

0 comments on commit a0d6717

Please sign in to comment.