Last active
May 21, 2021 11:15
-
-
Save letrastudio/33853ea7ae043c0c4fc34a73d7b16a27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function imageType(format) { | |
switch (format.toUpperCase()) { | |
case "JPEG": | |
case "JPG": | |
return { format: "JPEG", ext: "jpg", mimetype: "image/jpeg" } | |
case "PNG": | |
return { format: "PNG", ext: "png", mimetype: "image/png" } | |
case "GIF": | |
return { format: "GIF", ext: "gif", mimetype: "image/gif" } | |
case "SVG": | |
return { format: "SVG", ext: "svg", mimetype: "image/svg+xml" } | |
case "ICO": | |
return { format: "ICO", ext: "ico", mimetype: "image/x-icon" } | |
case "WEBP": | |
return { format: "WEBP", ext: "webp", mimetype: "image/webp" } | |
case "TIFF": | |
case "TIF": | |
return { format: "TIFF", ext: "tif", mimetype: "image/tiff" } | |
case "PSD": | |
return { format: "PSD", ext: "psd", mimetype: "image/vnd.adobe.photoshop" } | |
case "PDF": | |
return { format: "PDF", ext: "pdf", mimetype: "application/pdf" } | |
default: | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment