protected function validateImage (UploadedFile $handle)
    {
        $configs = $this->getConfigs();
        $maxSize = $configs['max_upload_size'];
        $extensions = $configs['extensions'];
        $imageConstraint = new Image();
        $imageConstraint->minWidth = $configs['minWidth'];
        $imageConstraint->minHeight = $configs['minHeight'];
        $imageConstraint->maxSize = $maxSize;
        $imageConstraint->mimeTypes =
            array_map(function($item){return 'image/' . $item;}, explode( ',',  $extensions));
        $errors = $this->container->get('validator')->validateValue($handle, $imageConstraint);

        if (count($errors) == 0) {
            return true;
        } else {
            return $this->container->get('translator')
                ->trans(/** @Ignore */$errors[0]->getMessageTemplate(), $errors[0]->getMessageParameters());
        }
    }
protected function validateImage (UploadedFile $handle)
    {
        $configs = $this->getConfigs();
        $maxSize = $configs['max_upload_size'];
        $extensions = $configs['extensions'];
        $imageConstraint = new Image();
        $imageConstraint->minWidth = $configs['minWidth'];
        $imageConstraint->minHeight = $configs['minHeight'];
        $imageConstraint->maxSize = $maxSize;
        $imageConstraint->mimeTypes =
            array_map(function($item){return 'image/' . $item;}, explode( ',',  $extensions));
        $errors = $this->container->get('validator')->validateValue($handle, $imageConstraint);

        if (count($errors) == 0) {
            return true;
        } else {
            return $this->container->get('translator')
                ->trans(/** @Ignore */$errors[0]->getMessageTemplate(), $errors[0]->getMessageParameters());
        }
    }
protected function validateImage ( UploadedFile $ handle ) { $ configs = $ this -> getConfigs ( ) ; $ maxSize = $ configs [ 'max_upload_size' ] ; $ extensions = $ configs [ 'extensions' ] ; $ imageConstraint = new Image ( ) ; $ imageConstraint -> minWidth = $ configs [ 'minWidth' ] ; $ imageConstraint -> minHeight = $ configs [ 'minHeight' ] ; $ imageConstraint -> maxSize = $ maxSize ; $ imageConstraint -> mimeTypes = array_map ( function ( $ item ) { return 'image/' . $ item ; } , explode ( ',' , $ extensions ) ) ; $ errors = $ this -> container -> get ( 'validator' ) -> validateValue ( $ handle , $ imageConstraint ) ; if ( count ( $ errors ) == 0 ) { return true ; } else { return $ this -> container -> get ( 'translator' ) -> trans ( /** @Ignore */ $ errors [ 0 ] -> getMessageTemplate ( ) , $ errors [ 0 ] -> getMessageParameters ( ) ) ; } }
Validates image and return true on success and
array of error messages on failure

@param UploadedFile $handle
@return boolean | string
Validates image and return true on success and array of error messages on failure