0

我正在将 Zikula 与 modulestudio 生成的模块一起使用。

liip的配置如下:

liip_imagine:
    resolvers:
        default:
            web_path:
                web_root: "%kernel.root_dir%/../"
                cache_prefix: "web/imagine/cache"
    loaders:
        zikula_root:
            filesystem:
                data_root: "%kernel.root_dir%/../"
    filter_sets:
        cache: ~
        my_thumb: # sample
            jpeg_quality: 90
            png_compression_level: 7
            filters:
                thumbnail: { size: [120, 90], mode: outbound }
                background: { size: [124, 94], position: center, color: '#000000' }
        zkroot: # sample using zikula root
            data_loader: zikula_root
            jpeg_quality: 90
            png_compression_level: 7
            filters:
                thumbnail: { size: [100, 100], mode: inset }
        # add more filters as required for your personal application

modulestudio 生成的文件被压缩的代码在这里:

$isImage = in_array($extension, $this->imageFileTypes);
if ($isImage) {
    // check if shrinking functionality is enabled
    $fieldSuffix = ucfirst($objectType) . ucfirst($fieldName);
    if (isset($this->moduleVars['enableShrinkingFor' . $fieldSuffix]) && true === (bool)$this->moduleVars['enableShrinkingFor' . $fieldSuffix]) {
        // check for maximum size
        $maxWidth = isset($this->moduleVars['shrinkWidth' . $fieldSuffix]) ? $this->moduleVars['shrinkWidth' . $fieldSuffix] : 800;
        $maxHeight = isset($this->moduleVars['shrinkHeight' . $fieldSuffix]) ? $this->moduleVars['shrinkHeight' . $fieldSuffix] : 600;
        $thumbMode = isset($this->moduleVars['thumbnailMode' . $fieldSuffix]) ? $this->moduleVars['thumbnailMode' . $fieldSuffix] : ImageInterface::THUMBNAIL_INSET;

        $imgInfo = getimagesize($destinationFilePath);
        if ($imgInfo[0] > $maxWidth || $imgInfo[1] > $maxHeight) {
            // resize to allowed maximum size
            ini_set('memory_limit', '1G');
            $imagine = new Imagine();
            $image = $imagine->open($destinationFilePath);
            $image->thumbnail(new Box($maxWidth, $maxHeight), $thumbMode)
                  ->save($destinationFilePath);
        }
    }
}

我的虚拟主机启用了 exif 的 php 扩展。

我的问题:

如果它成为一个新的缩略图文件,是否可以将 EXIF 数据保留在 jpg 文件中?还是必须缩小原始文件?

4

1 回答 1

-2

This has been solved by reading out EXIF data before creating the thumbnail image.

于 2017-12-12T18:43:04.577 回答