private function getExtension($filename) { if (preg_match('/(jpe?g|png|gif)/i', $filename, $m)) { return strtolower($m[1]); } return false; }