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


PHP CommandUtility::imageMagickCommand方法代码示例

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


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

示例1: render

 /**
  * @return string
  */
 public function render()
 {
     $path = GeneralUtility::getFileAbsFileName($this->arguments['path']);
     if (FALSE === file_exists($path)) {
         return NULL;
     }
     $density = $this->arguments['density'];
     $rotate = $this->arguments['rotate'];
     $page = intval($this->arguments['page']);
     $background = $this->arguments['background'];
     $forceOverwrite = (bool) $this->arguments['forceOverwrite'];
     $width = $this->arguments['width'];
     $height = $this->arguments['height'];
     $minWidth = $this->arguments['minWidth'];
     $minHeight = $this->arguments['minHeight'];
     $maxWidth = $this->arguments['maxWidth'];
     $maxHeight = $this->arguments['maxHeight'];
     $filename = basename($path);
     $pageArgument = $page > 0 ? $page - 1 : 0;
     $colorspace = TRUE === isset($GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace']) ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'] : 'RGB';
     $destination = GeneralUtility::getFileAbsFileName('typo3temp/vhs-pdf-' . $filename . '-page' . $page . '.png');
     if (FALSE === file_exists($destination) || TRUE === $forceOverwrite) {
         $arguments = '-colorspace ' . $colorspace;
         if (0 < intval($density)) {
             $arguments .= ' -density ' . $density;
         }
         if (0 !== intval($rotate)) {
             $arguments .= ' -rotate ' . $rotate;
         }
         $arguments .= ' "' . $path . '"[' . $pageArgument . ']';
         if (NULL !== $background) {
             $arguments .= ' -background "' . $background . '" -flatten';
         }
         $arguments .= ' "' . $destination . '"';
         $command = CommandUtility::imageMagickCommand('convert', $arguments);
         CommandUtility::exec($command);
     }
     $image = substr($destination, strlen(PATH_site));
     return parent::render($image, $width, $height, $minWidth, $minHeight, $maxWidth, $maxHeight);
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:43,代码来源:PdfThumbnailViewHelper.php

示例2: render

 /**
  * @return string
  */
 public function render()
 {
     $src = GeneralUtility::getFileAbsFileName($this->arguments['src']);
     if (false === file_exists($src)) {
         return null;
     }
     $density = $this->arguments['density'];
     $rotate = $this->arguments['rotate'];
     $page = (int) $this->arguments['page'];
     $background = $this->arguments['background'];
     $forceOverwrite = (bool) $this->arguments['forceOverwrite'];
     $filename = basename($src);
     $pageArgument = $page > 0 ? $page - 1 : 0;
     if (isset($GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'])) {
         $colorspace = $GLOBALS['TYPO3_CONF_VARS']['GFX']['colorspace'];
     } else {
         $colorspace = 'RGB';
     }
     $path = GeneralUtility::getFileAbsFileName('typo3temp/vhs-pdf-' . $filename . '-page' . $page . '.png');
     if (false === file_exists($path) || true === $forceOverwrite) {
         $arguments = '-colorspace ' . $colorspace;
         if (0 < (int) $density) {
             $arguments .= ' -density ' . $density;
         }
         if (0 !== (int) $rotate) {
             $arguments .= ' -rotate ' . $rotate;
         }
         $arguments .= ' "' . $src . '"[' . $pageArgument . ']';
         if (null !== $background) {
             $arguments .= ' -background "' . $background . '" -flatten';
         }
         $arguments .= ' "' . $path . '"';
         $command = CommandUtility::imageMagickCommand('convert', $arguments);
         CommandUtility::exec($command);
     }
     $this->preprocessImage($path);
     return $this->renderTag();
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:41,代码来源:PdfThumbnailViewHelper.php

示例3: imageMagickCommand

 /**
  * Compile the command for running ImageMagick/GraphicsMagick.
  *
  * @param string $command Command to be run: identify, convert or combine/composite
  * @param string $parameters The parameters string
  * @param string $path Override the default path (e.g. used by the install tool)
  * @return string Compiled command that deals with IM6 & GraphicsMagick
  */
 public static function imageMagickCommand($command, $parameters, $path = '')
 {
     return \TYPO3\CMS\Core\Utility\CommandUtility::imageMagickCommand($command, $parameters, $path);
 }
开发者ID:KarlDennisMatthaei1923,项目名称:PierraaDesign,代码行数:12,代码来源:GeneralUtility.php

示例4: determineImageMagickVersion

 /**
  * Determine ImageMagick / GraphicsMagick version
  *
  * @return string Version
  */
 protected function determineImageMagickVersion()
 {
     $command = \TYPO3\CMS\Core\Utility\CommandUtility::imageMagickCommand('identify', '-version');
     \TYPO3\CMS\Core\Utility\CommandUtility::exec($command, $result);
     $string = $result[0];
     list(, $version) = explode('Magick', $string);
     list($version) = explode(' ', trim($version));
     return trim($version);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:14,代码来源:TestSetup.php

示例5: imageMagickCommand

 /**
  * Compile the command for running ImageMagick/GraphicsMagick.
  *
  * @param string $command Command to be run: identify, convert or combine/composite
  * @param string $parameters The parameters string
  * @param string $path Override the default path (e.g. used by the install tool)
  * @return string Compiled command that deals with IM6 & GraphicsMagick
  */
 public static function imageMagickCommand($command, $parameters, $path = '')
 {
     return CommandUtility::imageMagickCommand($command, $parameters, $path);
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:12,代码来源:GeneralUtility.php

示例6: readPngGif

 /**
  * Returns filename of the png/gif version of the input file (which can be png or gif).
  * If input file type does not match the wanted output type a conversion is made and temp-filename returned.
  *
  * @param string $theFile Filepath of image file
  * @param bool $output_png If TRUE, then input file is converted to PNG, otherwise to GIF
  * @return string|NULL If the new image file exists, its filepath is returned
  */
 public static function readPngGif($theFile, $output_png = false)
 {
     if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled'] || !@is_file($theFile)) {
         return null;
     }
     $ext = strtolower(substr($theFile, -4, 4));
     if ((string) $ext == '.png' && $output_png || (string) $ext == '.gif' && !$output_png) {
         return $theFile;
     }
     if (!@is_dir(PATH_site . 'typo3temp/assets/images/')) {
         GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/assets/images/');
     }
     $newFile = PATH_site . 'typo3temp/assets/images/' . md5($theFile . '|' . filemtime($theFile)) . ($output_png ? '.png' : '.gif');
     $cmd = CommandUtility::imageMagickCommand('convert', '"' . $theFile . '" "' . $newFile . '"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_path']);
     CommandUtility::exec($cmd);
     if (@is_file($newFile)) {
         GeneralUtility::fixPermissions($newFile);
         return $newFile;
     }
     return null;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:29,代码来源:GraphicalFunctions.php

示例7: generatePreviewFromFile

 /**
  * Generates a preview for a file
  *
  * @param File $file The source file
  * @param array $configuration Processing configuration
  * @param string $targetFilePath Output file path
  * @return array|NULL
  */
 protected function generatePreviewFromFile(File $file, array $configuration, $targetFilePath)
 {
     $originalFileName = $file->getForLocalProcessing(false);
     // Check file extension
     if ($file->getType() != File::FILETYPE_IMAGE && !GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $file->getExtension())) {
         // Create a default image
         $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
         $graphicalFunctions->getTemporaryImageWithText($targetFilePath, 'Not imagefile!', 'No ext!', $file->getName());
         $result = array('filePath' => $targetFilePath);
     } elseif ($file->getExtension() === 'svg') {
         /** @var $gifBuilder \TYPO3\CMS\Frontend\Imaging\GifBuilder */
         $gifBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Imaging\GifBuilder::class);
         $gifBuilder->init();
         $gifBuilder->absPrefix = PATH_site;
         $info = $gifBuilder->getImageDimensions($originalFileName);
         $newInfo = $gifBuilder->getImageScale($info, $configuration['width'], $configuration['height'], array());
         $result = array('width' => $newInfo[0], 'height' => $newInfo[1], 'filePath' => '');
     } else {
         // Create the temporary file
         if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['processor_enabled']) {
             $parameters = '-sample ' . $configuration['width'] . 'x' . $configuration['height'] . ' ' . CommandUtility::escapeShellArgument($originalFileName) . '[0] ' . CommandUtility::escapeShellArgument($targetFilePath);
             $cmd = CommandUtility::imageMagickCommand('convert', $parameters) . ' 2>&1';
             CommandUtility::exec($cmd);
             if (!file_exists($targetFilePath)) {
                 // Create an error gif
                 $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
                 $graphicalFunctions->getTemporaryImageWithText($targetFilePath, 'No thumb', 'generated!', $file->getName());
             }
         }
         $result = array('filePath' => $targetFilePath);
     }
     return $result;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:41,代码来源:LocalPreviewHelper.php


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