Friday 22 April 2011 7:03:10 am
I have a problem on one of my plateform. On the admin interface when I create or edit a content with an image. When I validate it I get this message :
"Required data is either missing or is invalid: Image: A valid image file is required." To another plateform with the same ez publish configuration. I have no problem. I have no idee. In ez Publish files I find where the error message come from : ezimagetype.php :
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
{
$classAttribute = $contentObjectAttribute->contentClassAttribute();
$httpFileName = $base . "_data_imagename_" . $contentObjectAttribute->attribute( "id" );
$maxSize = 1024 * 1024 * $classAttribute->attribute( self::FILESIZE_FIELD );
$mustUpload = false;
if( $contentObjectAttribute->validateIsRequired() )
{
$tmpImgObj = $contentObjectAttribute->attribute( 'content' );
$original = $tmpImgObj->attribute( 'original' );
if ( !$original['is_valid'] )
{
$mustUpload = true;
}
}
$canFetchResult = eZHTTPFile::canFetch( $httpFileName, $maxSize );
if ( isset( $_FILES[$httpFileName] ) and $_FILES[$httpFileName]["tmp_name"] != "" )
{
$imagefile = $_FILES[$httpFileName]['tmp_name'];
if ( !$_FILES[$httpFileName]["size"] )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'The image file must have non-zero size.' ) );
return eZInputValidator::STATE_INVALID;
}
if ( function_exists( 'getimagesize' ) )
{
$info = getimagesize( $imagefile );
if ( !$info )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'A valid image file is required.' ) );
return eZInputValidator::STATE_INVALID;
}
}
else
{
$mimeType = eZMimeType::findByURL( $_FILES[$httpFileName]['name'] );
$nameMimeType = $mimeType['name'];
$nameMimeTypes = explode("/", $nameMimeType);
if ( $nameMimeTypes[0] != 'image' )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'A valid image file is required.' ) );
return eZInputValidator::STATE_INVALID;
}
}
}
if ( $mustUpload && $canFetchResult == eZHTTPFile::UPLOADEDFILE_DOES_NOT_EXIST )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'A valid image file is required.' ) );
return eZInputValidator::STATE_INVALID;
}
if ( $canFetchResult == eZHTTPFile::UPLOADEDFILE_EXCEEDS_PHP_LIMIT )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'The size of the uploaded image exceeds limit set by upload_max_filesize directive in php.ini. Please contact the site administrator.' ) );
return eZInputValidator::STATE_INVALID;
}
if ( $canFetchResult == eZHTTPFile::UPLOADEDFILE_EXCEEDS_MAX_SIZE )
{
$contentObjectAttribute->setValidationError( ezpI18n::tr( 'kernel/classes/datatypes',
'The size of the uploaded file exceeds the limit set for this site: %1 bytes.' ), $maxSize );
return eZInputValidator::STATE_INVALID;
}
return eZInputValidator::STATE_ACCEPTED; } If anybody have an idee you are welcome. Finally sorry for my English I'm a Frenchy user ;).
|