framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
public static function isImageValid($filePath, $extension)
    {
        if (!@is_readable($filePath)) {
            return -1;
        }

        $imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'psd', 'bmp', 'tiff');

        // version_compare is available since PHP4 >= 4.0.7
        if ( function_exists( 'version_compare' ) ) {
            $sCurrentVersion = phpversion();
            if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
                $imageCheckExtensions[] = "tiff";
                $imageCheckExtensions[] = "tif";
            }
            if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
                $imageCheckExtensions[] = "swc";
            }
            if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
                $imageCheckExtensions[] = "jpc";
                $imageCheckExtensions[] = "jp2";
                $imageCheckExtensions[] = "jpx";
                $imageCheckExtensions[] = "jb2";
                $imageCheckExtensions[] = "xbm";
                $imageCheckExtensions[] = "wbmp";
            }
        }

        if ( !in_array( $extension, $imageCheckExtensions ) ) {
            return true;
        }

        if ( @getimagesize( $filePath ) === false ) {
            return false ;
        }

        return true;
    }
public static function isImageValid($filePath, $extension)
    {
        if (!@is_readable($filePath)) {
            return -1;
        }

        $imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'psd', 'bmp', 'tiff');

        // version_compare is available since PHP4 >= 4.0.7
        if ( function_exists( 'version_compare' ) ) {
            $sCurrentVersion = phpversion();
            if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) {
                $imageCheckExtensions[] = "tiff";
                $imageCheckExtensions[] = "tif";
            }
            if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) {
                $imageCheckExtensions[] = "swc";
            }
            if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) {
                $imageCheckExtensions[] = "jpc";
                $imageCheckExtensions[] = "jp2";
                $imageCheckExtensions[] = "jpx";
                $imageCheckExtensions[] = "jb2";
                $imageCheckExtensions[] = "xbm";
                $imageCheckExtensions[] = "wbmp";
            }
        }

        if ( !in_array( $extension, $imageCheckExtensions ) ) {
            return true;
        }

        if ( @getimagesize( $filePath ) === false ) {
            return false ;
        }

        return true;
    }
public static function isImageValid ( $ filePath , $ extension ) { if ( ! @ is_readable ( $ filePath ) ) { return - 1 ; } $ imageCheckExtensions = array ( 'gif' , 'jpeg' , 'jpg' , 'png' , 'psd' , 'bmp' , 'tiff' ) ; // version_compare is available since PHP4 >= 4.0.7 if ( function_exists ( 'version_compare' ) ) { $ sCurrentVersion = phpversion ( ) ; if ( version_compare ( $ sCurrentVersion , "4.2.0" ) >= 0 ) { $ imageCheckExtensions [ ] = "tiff" ; $ imageCheckExtensions [ ] = "tif" ; } if ( version_compare ( $ sCurrentVersion , "4.3.0" ) >= 0 ) { $ imageCheckExtensions [ ] = "swc" ; } if ( version_compare ( $ sCurrentVersion , "4.3.2" ) >= 0 ) { $ imageCheckExtensions [ ] = "jpc" ; $ imageCheckExtensions [ ] = "jp2" ; $ imageCheckExtensions [ ] = "jpx" ; $ imageCheckExtensions [ ] = "jb2" ; $ imageCheckExtensions [ ] = "xbm" ; $ imageCheckExtensions [ ] = "wbmp" ; } } if ( ! in_array ( $ extension , $ imageCheckExtensions ) ) { return true ; } if ( @ getimagesize ( $ filePath ) === false ) { return false ; } return true ; }
Check file content.
Currently this function validates only image files.
Returns false if file is invalid.

@static
@access public
@param string $filePath absolute path to file
@param string $extension file extension
@param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images
@return boolean
Check file content . Currently this function validates only image files . Returns false if file is invalid .