当前位置: 首页>>代码示例>>PHP>>正文


PHP eZMimeType::changeDirectoryPath方法代码示例

本文整理汇总了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;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:20,代码来源:ezstylepackagecreator.php

示例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;
开发者ID:nottavi,项目名称:ezpublish,代码行数:67,代码来源:ezimagemanager.php

示例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);
 }
开发者ID:,项目名称:,代码行数:41,代码来源:


注:本文中的eZMimeType::changeDirectoryPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。