decoy icon indicating copy to clipboard operation
decoy copied to clipboard

Upload svg in image field, "width cannot be null"

Open eminos opened this issue 8 years ago • 2 comments

When uploading an svg file into an image type field it gives the SQL error "width cannot be null".

eminos avatar Dec 03 '17 13:12 eminos

Here is where the width is measured: https://github.com/BKWLD/decoy/blob/master/classes/Models/Image.php#L193

I could do something like:

https://stackoverflow.com/a/14105726/59160

Or maybe allow width / height to be null ... I don't think Decoy ever does anything with those values, so I think they could be null.

weotch avatar Dec 04 '17 15:12 weotch

I have made width and height columns in the DB table nullable. That kinda solved the problem, and now svg files are uploadable in an image field. But then I've noticed two other bugs:

  • The image is not shown/previewed in the field in Decoy.
  • Some error in the console.

I think Decoy is trying to make a thumbnail of the uploaded image, which fails with svg files.

eminos avatar Dec 04 '17 15:12 eminos