Skip to content

Commit

Permalink
fix: catchImage #21
Browse files Browse the repository at this point in the history
  • Loading branch information
eddy8 committed May 11, 2021
1 parent 3c9a19b commit ba815d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/Http/Controllers/Admin/NEditorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,15 @@ protected function fetchImageFile($url)
$image = Image::make(imagecreatefromwebp($url));
$extension = 'webp';
} else {
$image = Image::make($data);
$resource = @imagecreatefromstring($data);

if ($resource === false) {
throw new NotReadableException(
"Unable to init from given binary data."
);
}
$image = Image::make($resource);
$image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
}
} catch (NotReadableException $e) {
return false;
Expand Down

0 comments on commit ba815d5

Please sign in to comment.