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


PHP FileInterface::getForLocalProcessing方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Resource\FileInterface::getForLocalProcessing方法的典型用法代码示例。如果您正苦于以下问题:PHP FileInterface::getForLocalProcessing方法的具体用法?PHP FileInterface::getForLocalProcessing怎么用?PHP FileInterface::getForLocalProcessing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Resource\FileInterface的用法示例。


在下文中一共展示了FileInterface::getForLocalProcessing方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: extractMetaData

 /**
  * Takes a file reference and extracts its meta data.
  *
  * @param \TYPO3\CMS\Core\Resource\FileInterface $file
  * @return array
  */
 public function extractMetaData(FileInterface $file)
 {
     $localTempFilePath = $file->getForLocalProcessing(FALSE);
     $query = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Tika\\Service\\Tika\\SolrCellQuery', $localTempFilePath);
     $query->setExtractOnly();
     $response = $this->solr->extract($query);
     $metaData = $this->solrResponseToArray($response[1]);
     $this->cleanupTempFile($localTempFilePath, $file);
     $this->log('Meta Data Extraction using Solr', array('file' => $file, 'solr connection' => (array) $this->solr, 'query' => (array) $query, 'response' => $response, 'meta data' => $metaData));
     return $metaData;
 }
开发者ID:visol,项目名称:ext-tika,代码行数:17,代码来源:SolrCellService.php

示例2: extractText

 /**
  * The actual text extraction.
  *
  * @param FileInterface $file
  * @return string
  */
 public function extractText(FileInterface $file)
 {
     $localTempFile = $file->getForLocalProcessing(false);
     // extract text
     $content = file_get_contents($localTempFile);
     // In case of remote storage, the temporary copy of the
     // original file in typo3temp must be removed
     // Simply compare the filenames, because the filename is so unique that
     // it is nearly impossible to have a file with this name in a storage
     if (PathUtility::basename($localTempFile) !== $file->getName()) {
         unlink($localTempFile);
     }
     return $content;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:20,代码来源:PlainTextExtractor.php

示例3: createMagicImage

 /**
  * Creates a magic image
  *
  * @param \TYPO3\CMS\Core\Resource\FileInterface $imageFileObject: the original image file
  * @param array $fileConfiguration (width, height, maxW, maxH)
  * @param string $targetFolderCombinedIdentifier: target folder combined identifier
  * @return \TYPO3\CMS\Core\Resource\FileInterface
  */
 public function createMagicImage(\TYPO3\CMS\Core\Resource\FileInterface $imageFileObject, array $fileConfiguration, $targetFolderCombinedIdentifier)
 {
     $magicImage = NULL;
     // Get file for processing
     $imageFilePath = $imageFileObject->getForLocalProcessing(TRUE);
     // Process dimensions
     $maxWidth = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($fileConfiguration['width'], 0, $fileConfiguration['maxW']);
     $maxHeight = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($fileConfiguration['height'], 0, $fileConfiguration['maxH']);
     if (!$maxWidth) {
         $maxWidth = $fileConfiguration['maxW'];
     }
     if (!$maxHeight) {
         $maxHeight = $fileConfiguration['maxH'];
     }
     // Create the magic image
     $magicImageInfo = $this->getImageObject()->imageMagickConvert($imageFilePath, 'WEB', $maxWidth . 'm', $maxHeight . 'm');
     if ($magicImageInfo[3]) {
         $targetFileName = 'RTEmagicC_' . pathInfo($imageFileObject->getName(), PATHINFO_FILENAME) . '.' . pathinfo($magicImageInfo[3], PATHINFO_EXTENSION);
         $magicFolder = $this->getMagicFolder($targetFolderCombinedIdentifier);
         if ($magicFolder instanceof \TYPO3\CMS\Core\Resource\Folder) {
             $magicImage = $magicFolder->addFile($magicImageInfo[3], $targetFileName, 'changeName');
         }
     }
     return $magicImage;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:33,代码来源:MagicImageService.php

示例4: processImageCropResizeMask

 /**
  * This method actually does the processing of files locally
  *
  * takes the original file (on remote storages this will be fetched from the remote server)
  * does the IM magic on the local server by creating a temporary typo3temp/ file
  * copies the typo3temp/ file to the processingfolder of the target storage
  * removes the typo3temp/ file
  *
  * @param \TYPO3\CMS\Core\Resource\ProcessedFile $processedFile
  * @param \TYPO3\CMS\Core\Resource\FileInterface $file
  * @param array $configuration
  * @return void
  */
 protected function processImageCropResizeMask(\TYPO3\CMS\Core\Resource\ProcessedFile $processedFile, \TYPO3\CMS\Core\Resource\FileInterface $file, array $configuration)
 {
     // checks to see if m (the mask array) is defined
     $doMasking = is_array($configuration['maskImages']) && $GLOBALS['TYPO3_CONF_VARS']['GFX']['im'];
     // @todo: is it ok that we use tslib (=FE) here?
     /** @var $gifBuilder tslib_gifbuilder */
     $gifBuilder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_gifbuilder');
     $gifBuilder->init();
     // @todo: this is not clean yet
     if (!trim($configuration['fileExtension'])) {
         $configuration['fileExtension'] = 'web';
         $targetFileExtension = $file->getExtension();
     } elseif ($doMasking) {
         $targetFileExtension = $file->getExtension() == $gifBuilder->gifExtension ? $gifBuilder->gifExtension : 'jpg';
     } else {
         $targetFileExtension = $configuration['fileExtension'];
     }
     $originalFileName = $file->getForLocalProcessing(FALSE);
     $targetFolder = $this->storage->getProcessingFolder();
     $targetFileName = 'previewcrm_' . $processedFile->calculateChecksum() . '.' . $targetFileExtension;
     // @todo: implement meaningful TempFileIndex
     if ($configuration['useSample']) {
         $gifBuilder->scalecmd = '-sample';
     }
     $options = array();
     if ($configuration['maxWidth']) {
         $options['maxW'] = $configuration['maxWidth'];
     }
     if ($configuration['maxHeight']) {
         $options['maxH'] = $configuration['maxHeight'];
     }
     if ($configuration['minWidth']) {
         $options['minW'] = $configuration['minWidth'];
     }
     if ($configuration['minHeight']) {
         $options['minH'] = $configuration['minHeight'];
     }
     $options['noScale'] = $configuration['noScale'];
     $configuration['additionalParameters'] = $this->modifyImageMagickStripProfileParameters($configuration['additionalParameters'], $configuration);
     // Do the actual processing
     if (!$targetFolder->hasFile($targetFileName)) {
         if (!$doMasking) {
             // Normal situation (no masking)
             // the result info is an array with 0=width,1=height,2=extension,3=filename
             list($targetWidth, $targetHeight, $targetExtension, $temporaryFileName) = $gifBuilder->imageMagickConvert($originalFileName, $configuration['fileExtension'], $configuration['width'], $configuration['height'], $configuration['additionalParameters'], $configuration['frame'], $options);
         } else {
             $temporaryFileName = $gifBuilder->tempPath . $targetFileName;
             $maskImage = $configuration['maskImages']['maskImage'];
             $maskBackgroundImage = $configuration['maskImages']['backgroundImage'];
             if ($maskImage instanceof \TYPO3\CMS\Core\Resource\FileInterface && $maskBackgroundImage instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                 $negate = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask'] ? ' -negate' : '';
                 $temporaryExtension = 'png';
                 if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_gif']) {
                     // If ImageMagick version 5+
                     $temporaryExtension = $gifBuilder->gifExtension;
                 }
                 $tempFileInfo = $gifBuilder->imageMagickConvert($originalFileName, $temporaryExtension, $configuration['width'], $configuration['height'], $configuration['additionalParameters'], $configuration['frame'], $options);
                 if (is_array($tempFileInfo)) {
                     $maskBottomImage = $configuration['maskImages']['maskBottomImage'];
                     if ($maskBottomImage instanceof $maskBottomImage) {
                         $maskBottomImageMask = $configuration['maskImages']['maskBottomImageMask'];
                     }
                     //	Scaling:	****
                     $tempScale = array();
                     $command = '-geometry ' . $tempFileInfo[0] . 'x' . $tempFileInfo[1] . '!';
                     $command = $this->modifyImageMagickStripProfileParameters($command, $configuration);
                     $tmpStr = $gifBuilder->randomName();
                     //	m_mask
                     $tempScale['m_mask'] = $tmpStr . '_mask.' . $temporaryExtension;
                     $gifBuilder->imageMagickExec($maskImage->getForLocalProcessing(TRUE), $tempScale['m_mask'], $command . $negate);
                     //	m_bgImg
                     $tempScale['m_bgImg'] = $tmpStr . '_bgImg.' . trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
                     $gifBuilder->imageMagickExec($maskBackgroundImage->getForLocalProcessing(), $tempScale['m_bgImg'], $command);
                     //	m_bottomImg / m_bottomImg_mask
                     if ($maskBottomImage instanceof \TYPO3\CMS\Core\Resource\FileInterface && $maskBottomImageMask instanceof \TYPO3\CMS\Core\Resource\FileInterface) {
                         $tempScale['m_bottomImg'] = $tmpStr . '_bottomImg.' . $temporaryExtension;
                         $gifBuilder->imageMagickExec($maskBottomImage->getForLocalProcessing(), $tempScale['m_bottomImg'], $command);
                         $tempScale['m_bottomImg_mask'] = $tmpStr . '_bottomImg_mask.' . $temporaryExtension;
                         $gifBuilder->imageMagickExec($maskBottomImageMask->getForLocalProcessing(), $tempScale['m_bottomImg_mask'], $command . $negate);
                         // BEGIN combining:
                         // The image onto the background
                         $gifBuilder->combineExec($tempScale['m_bgImg'], $tempScale['m_bottomImg'], $tempScale['m_bottomImg_mask'], $tempScale['m_bgImg']);
                     }
                     // The image onto the background
                     $gifBuilder->combineExec($tempScale['m_bgImg'], $tempFileInfo[3], $tempScale['m_mask'], $temporaryFileName);
                     // Unlink the temp-images...
                     foreach ($tempScale as $file) {
//.........这里部分代码省略.........
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:101,代码来源:FileProcessingService.php

示例5: insertPlainImage

 /**
  * Insert a plain image
  *
  * @param \TYPO3\CMS\Core\Resource\FileInterface $fileObject: the image file
  * @param 	string		$altText: text for the alt attribute of the image
  * @param 	string		$titleText: text for the title attribute of the image
  * @param 	string		$additionalParams: text representing more HTML attributes to be added on the img tag
  * @return 	void
  */
 public function insertPlainImage(\TYPO3\CMS\Core\Resource\FileInterface $fileObject, $altText = '', $titleText = '', $additionalParams = '')
 {
     $filePath = $fileObject->getForLocalProcessing(FALSE);
     $imageInfo = @getimagesize($filePath);
     $imageUrl = $this->siteURL . substr($filePath, strlen(PATH_site));
     $this->imageInsertJS($imageUrl, $imageInfo[0], $imageInfo[1], $altText, $titleText, $additionalParams);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:16,代码来源:SelectImage.php

示例6: detectLanguageFromFile

 /**
  * Takes a file reference and detects its content's language.
  *
  * @param \TYPO3\CMS\Core\Resource\FileInterface $file
  * @return string Language ISO code
  */
 public function detectLanguageFromFile(FileInterface $file)
 {
     $localTempFilePath = $file->getForLocalProcessing(FALSE);
     $language = $this->detectLanguageFromLocalFile($localTempFilePath);
     $this->cleanupTempFile($localTempFilePath, $file);
     return $language;
 }
开发者ID:visol,项目名称:ext-tika,代码行数:13,代码来源:AppService.php


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