首页 > 解决方案 > \TYPO3\CMS\Frontend\Imaging\Gifbuilder 未生成图像

问题描述

我正在尝试GIFBUILDER与 php 一起使用,但没有生成图像。

这是我的 php 代码,基于 GifBuilder.php 中的示例

    public function gifBuilder(array $fileArray)
    {
        $gifCreator = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Imaging\Gifbuilder::class);
        $gifCreator->init();
        $theImage ='';
        if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) { 
            $gifCreator->start($fileArray, $this->data);
            $theImage = $gifCreator->gifBuild();
            error_log("Setup: ".var_export($theImage, true),0);
            } 
    //      return $gifCreator->getImageDimensions($theImage); 
        return $theImage;
    }

我对示例代码有疑问。我不明白为什么返回值应该是“getImageDimension”?我将其更改为$theImage,因为我认为这应该是生成的图像。
但无论如何,不​​会生成图像。

这里$fileArray, 发送到函数:

    [16-Nov-2020 20:10:25 Europe/Berlin] Config: array (
    'file' => 'typo3conf/ext/imagetext/Resources/Public/Images/Plattenteller.jpg',
    'file.' => 
    array (
      'maxW' => 200,
      'maxH' => 200,
    ),
    )

我也用这个数组试过:

    [16-Nov-2020 20:09:29 Europe/Berlin] Config: array (
      'file' => 'GIFBUILDER',
      'file.' => 
      array (
        'format' => 'jpg',
        'XY' => '3157,1929',
        'width' => '500',
        1 => 'IMAGE',
        '1.' => 
        array (
          'file' => 'typo3conf/ext/imagetext/Resources/Public/Images/Plattenteller.jpg',
        ),
        4 => 'CROP',
        '4.' => 
        array (
          'crop' => '400,400,1000,1000',
        ),
        5 => 'SCALE',
        '5.' => 
        array (
          'width' => '400',
        ),
        10 => 'TEXT',
        '10.' => 
        array (
          'text' => 'Country-Musik',
          'offset' => '5,30',
          'fontColor' => 'yellow',
          'fontSize' => '20',
          'niceText' => '1',
        ),
      ),
    )

但是两个数组都不会创建输出。

我希望有人能帮助我!

编辑:

我正在使用 Typo V9.5.22

CROP 的第二个例子我已经开始使用 Typoscript。

标签: phptypo3typoscript

解决方案


推荐阅读