Last active
November 30, 2016 14:03
-
-
Save haruaki64/a18a8db39ab4b235c10ae0efcbea843f to your computer and use it in GitHub Desktop.
画像ファイルのMIMEから拡張子を判定する関数
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
public function getExtensionFromMIME ($mime) { | |
switch ($mime) { | |
case "image/gif": | |
$ret = ".gif"; | |
break; | |
case "image/jpeg": | |
$ret = ".jpg"; | |
break; | |
case "image/png": | |
$ret = ".png"; | |
break; | |
default: | |
$ret = ""; | |
break; | |
} | |
return $ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment