File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,11 @@ public function resizeToThumbnailUrl(
66
66
bool $ keepRatio = false ,
67
67
bool $ shouldCreate = false
68
68
): ?string {
69
+ // Do not attempt to resize SVGs, return the raw value always.
70
+ if ($ this ->isSvg ($ image )) {
71
+ return $ this ->storage ->getPublicUrl ($ image ->path );
72
+ }
73
+
69
74
// Do not resize GIF images where we're not cropping
70
75
if ($ keepRatio && $ this ->isGif ($ image )) {
71
76
return $ this ->storage ->getPublicUrl ($ image ->path );
@@ -226,6 +231,14 @@ protected function isGif(Image $image): bool
226
231
return $ this ->getExtension ($ image ) === 'gif ' ;
227
232
}
228
233
234
+ /**
235
+ * Checks if the image is a svg. Returns true if it is, else false.
236
+ */
237
+ protected function isSvg (Image $ image ): bool
238
+ {
239
+ return $ this ->getExtension ($ image ) === 'svg ' ;
240
+ }
241
+
229
242
/**
230
243
* Get the extension for the given image, normalised to lower-case.
231
244
*/
You can’t perform that action at this time.
0 commit comments