src/S3/Image.php
public static function isImage($name)
    {
        if (isset($_FILES[$name])) {
            $tempFile = $_FILES[$name]['tmp_name'];
            if (!empty($tempFile) && file_exists($tempFile)) {
                $image = getimagesize($tempFile);
                switch ($image['mime']) {
                    case 'image/gif':
                    case 'image/png':
                    case 'image/bmp':
                    case 'image/tiff':
                    case 'image/jpeg':
                        return true;
                }
            }
        }

        if (file_exists($name)) {
            $image = getimagesize($name);
            switch ($image['mime']) {
                case 'image/gif':
                case 'image/png':
                case 'image/bmp':
                case 'image/tiff':
                case 'image/jpeg':
                    return true;
            }
        }

        return false;
    }
public static function isImage($name)
    {
        if (isset($_FILES[$name])) {
            $tempFile = $_FILES[$name]['tmp_name'];
            if (!empty($tempFile) && file_exists($tempFile)) {
                $image = getimagesize($tempFile);
                switch ($image['mime']) {
                    case 'image/gif':
                    case 'image/png':
                    case 'image/bmp':
                    case 'image/tiff':
                    case 'image/jpeg':
                        return true;
                }
            }
        }

        if (file_exists($name)) {
            $image = getimagesize($name);
            switch ($image['mime']) {
                case 'image/gif':
                case 'image/png':
                case 'image/bmp':
                case 'image/tiff':
                case 'image/jpeg':
                    return true;
            }
        }

        return false;
    }
public static function isImage ( $ name ) { if ( isset ( $ _FILES [ $ name ] ) ) { $ tempFile = $ _FILES [ $ name ] [ 'tmp_name' ] ; if ( ! empty ( $ tempFile ) && file_exists ( $ tempFile ) ) { $ image = getimagesize ( $ tempFile ) ; switch ( $ image [ 'mime' ] ) { case 'image/gif' : case 'image/png' : case 'image/bmp' : case 'image/tiff' : case 'image/jpeg' : return true ; } } } if ( file_exists ( $ name ) ) { $ image = getimagesize ( $ name ) ; switch ( $ image [ 'mime' ] ) { case 'image/gif' : case 'image/png' : case 'image/bmp' : case 'image/tiff' : case 'image/jpeg' : return true ; } } return false ; }
Checks whether a file is an image

@param string $name Name of the $_FILES[] field to be checked

@return bool
Checks whether a file is an image