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(
6666 bool $ keepRatio = false ,
6767 bool $ shouldCreate = false
6868 ): ?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+
6974 // Do not resize GIF images where we're not cropping
7075 if ($ keepRatio && $ this ->isGif ($ image )) {
7176 return $ this ->storage ->getPublicUrl ($ image ->path );
@@ -226,6 +231,14 @@ protected function isGif(Image $image): bool
226231 return $ this ->getExtension ($ image ) === 'gif ' ;
227232 }
228233
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+
229242 /**
230243 * Get the extension for the given image, normalised to lower-case.
231244 */
You can’t perform that action at this time.
0 commit comments