Replies: 2 comments
-
Looking into the issue a little more, the issue actually isn't the |
Beta Was this translation helpful? Give feedback.
-
After contemplating over a potential solution I just discovered the
This seems to solve the issue for me, since the image isn't attached anymore when the provided image has That being said I would vastly appreciate a couple of constants providing common media formats that this library is able to coup with. Common categories that come to mind are:
IMO it would be sufficient to have class ValidMimeTypes
{
// list taken from https://github.com/Intervention/image/blob/54934ae8ea3661fd189437df90fb09ec3b679c74/src/Intervention/Image/Gd/Decoder.php#L30-L65
public const IMAGE = [
'image/png',
'image/x-png',
'image/jpg',
'image/jpeg',
'image/pjpeg',
'image/gif',
'image/webp',
'image/x-webp',
'image/bmp',
'image/ms-bmp',
'image/x-bitmap',
'image/x-bmp',
'image/x-ms-bmp',
'image/x-win-bitmap',
'image/x-windows-bmp',
'image/x-xbitmap',
];
// ...
} That way, we could pass those into |
Beta Was this translation helpful? Give feedback.
-
Problem statement:
When trying to add media from url and it fails with a
Intervention\Image\Exception\NotReadableException
, the media record is still created and attached to the respective model.Desired behavior:
IMHO the correct behavior would be to not create the media record at all when the item can not be processed due to invalid mime type etc. I thought about wrapping it in a
try-catch
block and delete the media in thecatch
block again. However in our case this would lead to drastic increase of the auto-increment that are totally unnecessary and hence may lead to issues down the line.Additional information:
Specific call:
Stack trace (excerpt):
Versions:
Beta Was this translation helpful? Give feedback.
All reactions