本文整理汇总了PHP中eZMimeType::changeDirectoryPath方法的典型用法代码示例。如果您正苦于以下问题:PHP eZMimeType::changeDirectoryPath方法的具体用法?PHP eZMimeType::changeDirectoryPath怎么用?PHP eZMimeType::changeDirectoryPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZMimeType
的用法示例。
在下文中一共展示了eZMimeType::changeDirectoryPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateImageFiles
function validateImageFiles( $package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList )
{
// If we don't have an image we continue as normal
if ( !eZHTTPFile::canFetch( 'PackageImageFile' ) )
return true;
$file = eZHTTPFile::fetch( 'PackageImageFile' );
$result = true;
if ( $file )
{
$mimeData = eZMimeType::findByFileContents( $file->attribute( 'original_filename' ) );
$dir = eZSys::storageDirectory() . '/temp';
eZMimeType::changeDirectoryPath( $mimeData, $dir );
$file->store( false, false, $mimeData );
$persistentData['imagefiles'][] = $mimeData;
$result = false;
}
return $result;
}
示例2: convert
//.........这里部分代码省略.........
$outputMimeData = $handler->outputMIMEType( $this, $currentMimeData, $destinationMimeData, $this->SupportedFormats, $aliasName );
if ( $outputMimeData['name'] == $destinationMimeData['name'] and count( $handlerFilters ) > 0 )
{
$nextMimeData = $outputMimeData;
$nextHandler = $handler;
break;
}
if ( $outputMimeData and
!$nextMimeData )
{
$nextMimeData = $outputMimeData;
$nextHandler = $handler;
}
}
if ( !$nextMimeData )
{
eZDebug::writeError( "None of the handlers can convert MIME-Type " . $currentMimeData['name'], __METHOD__ );
if ( isset( $sourceFile ) )
$sourceFile->deleteLocal();
return false;
}
$useTempImage = false;
if ( $nextMimeData['name'] == $destinationMimeData['name'] and
count( $leftoverFilters ) == 0 )
{
$nextMimeData['dirpath'] = $destinationMimeData['dirpath'];
}
else
{
$useTempImage = true;
$nextMimeData['dirpath'] = $this->temporaryImageDirPath();
}
eZMimeType::changeDirectoryPath( $nextMimeData, $nextMimeData['dirpath'] );
if ( $nextMimeData['dirpath'] and
!file_exists( $nextMimeData['dirpath'] ) )
eZDir::mkdir( $nextMimeData['dirpath'], false, true );
if ( $currentMimeData['name'] == $nextMimeData['name'] and
count( $handlerFilters ) == 0 )
{
if ( $currentMimeData['url'] != $nextMimeData['url'] )
{
if ( eZFileHandler::copy( $currentMimeData['url'], $nextMimeData['url'] ) )
{
if ( $useTempImage )
$tempFiles[] = $nextMimeData['url'];
}
else
{
$result = false;
break;
}
}
$currentMimeData = $nextMimeData;
}
else
{
if ( $nextHandler->convert( $this, $currentMimeData, $nextMimeData, $handlerFilters ) )
{
if ( $useTempImage )
$tempFiles[] = $nextMimeData['url'];
}
else
{
$result = false;
示例3: initializeFromFile
function initializeFromFile($filename, $imageAltText = false, $originalFilename = false)
{
if (!file_exists($filename)) {
$contentObjectID = isset($this->ContentObjectAttributeData['contentobject_id']) ? $this->ContentObjectAttributeData['contentobject_id'] : 0;
$contentObjectAttributeID = isset($this->ContentObjectAttributeData['id']) ? $this->ContentObjectAttributeData['id'] : 0;
$version = isset($this->ContentObjectAttributeData['version']) ? $this->ContentObjectAttributeData['version'] : 0;
$contentObject = eZContentObject::fetch($contentObjectID);
$contentObjectAttribute = eZContentObjectAttribute::fetch($contentObjectAttributeID, $version);
$contentObjectAttributeName = '';
$contentObjectName = '';
if ($contentObject instanceof eZContentObject) {
$contentObjectName = $contentObject->attribute('name');
}
if ($contentObjectAttribute instanceof eZContentObjectAttribute) {
$contentObjectAttributeName = $contentObjectAttribute->attribute('contentclass_attribute_name');
}
eZDebug::writeError("The image '{$filename}' does not exist, cannot initialize image attribute: '{$contentObjectAttributeName}' (id: {$contentObjectAttributeID}) for content object: '{$contentObjectName}' (id: {$contentObjectID})", __METHOD__);
return false;
}
$this->increaseImageSerialNumber();
if (!$originalFilename) {
$originalFilename = basename($filename);
}
$mimeData = eZMimeType::findByFileContents($filename);
if (!$mimeData['is_valid'] and $originalFilename != $filename) {
$mimeData = eZMimeType::findByFileContents($originalFilename);
}
$attr = false;
$this->removeAliases($attr);
$this->setOriginalAttributeDataValues($this->ContentObjectAttributeData['id'], $this->ContentObjectAttributeData['version'], $this->ContentObjectAttributeData['language_code']);
$contentVersion = eZContentObjectVersion::fetchVersion($this->ContentObjectAttributeData['version'], $this->ContentObjectAttributeData['contentobject_id']);
$objectName = $this->imageName($this->ContentObjectAttributeData, $contentVersion);
$objectPathString = $this->imagePath($this->ContentObjectAttributeData, $contentVersion, true);
eZMimeType::changeBaseName($mimeData, $objectName);
eZMimeType::changeDirectoryPath($mimeData, $objectPathString);
if (!file_exists($mimeData['dirpath'])) {
eZDir::mkdir($mimeData['dirpath'], false, true);
}
eZFileHandler::copy($filename, $mimeData['url']);
return $this->initialize($mimeData, $originalFilename, $imageAltText);
}