2017-03-28 07:25:36 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
exports.isSQLite = function isSQLite (sequelize) {
|
|
|
|
return sequelize.options.dialect === 'sqlite'
|
|
|
|
}
|
2017-05-08 08:22:52 +00:00
|
|
|
|
|
|
|
exports.getImageMimeType = function getImageMimeType (imagePath) {
|
|
|
|
var fileExtension = /[^.]+$/.exec(imagePath)
|
|
|
|
|
|
|
|
switch (fileExtension[0]) {
|
2017-05-08 09:00:45 +00:00
|
|
|
case 'bmp':
|
|
|
|
return 'image/bmp'
|
|
|
|
case 'gif':
|
|
|
|
return 'image/gif'
|
|
|
|
case 'jpg':
|
|
|
|
case 'jpeg':
|
|
|
|
return 'image/jpeg'
|
|
|
|
case 'png':
|
|
|
|
return 'image/png'
|
|
|
|
case 'tiff':
|
|
|
|
return 'image/tiff'
|
2019-06-18 14:57:58 +00:00
|
|
|
case 'svg':
|
|
|
|
return 'image/svg+xml'
|
2017-05-08 08:22:52 +00:00
|
|
|
default:
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
}
|