CKFinder.Connector.ImageTools.ValidateImage C# (CSharp) Method

ValidateImage() public static method

public static ValidateImage ( string filePath ) : bool
filePath string
return bool
        public static bool ValidateImage( string filePath )
        {
            System.Drawing.Image sourceImage;

            try
            {
                System.IO.Stream fileStream = Achilles.Acme.Storage.IO.File.OpenRead( filePath );

                sourceImage = System.Drawing.Image.FromStream( fileStream );
                sourceImage.Dispose();
                return true;
            }
            catch
            {
                // This is not a valid image. Do nothing.
                return false;
            }
        }