compression - Sitecore 'getMediaStream' 无法正常工作

标签 compression sitecore pipeline

现在我使用 Dianoga ( https://github.com/kamsar/Dianoga ) 进行图像压缩。 该工具适用于 png 和 jpg/jpeg 文件,PNG 文件工作正常。但是,如果我上传 JPG 文件,上传工具框就会像截图一样卡住。

enter image description here

这是执行线。

var jpegtran = Process.Start(ToolPath, " -optimize -copy none -progressive -outfile \"{0}\" \"{0}\"".FormatWith(tempFilePath));



如果我更改代码,例如,

var jpegtran = Process.Start(ToolPath, " -optimize -copy none -progressive -outfile \"{1}\" \"{0}\"".FormatWith(tempFilePath));

JPG 文件已更新,但没有压缩过程。日志显示,

“错误无法运行“/sitecore/media library/Images/satellite-westtibet”的“getMediaStream”管道。将使用原始媒体数据”



这是我的 web.config 文件,位于/App_Config/Include/中。

<?xml version="1.0" encoding="UTF-8"?>
    <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <sitecore>
            <processors>
                <attachFile argsType="Sitecore.Pipelines.Attach.AttachArgs">
                    <processor mode="on" type="Validations.Attach.ImageAttachMaxSize, Custom.Validations" patch:before="processor [@type='Sitecore.Pipelines.Attach.CheckSize,Sitecore.Kernel']">
                        <restrictedExtensions hint="list">
                            <extension>.jpg</extension>
                            <extension>.jepg</extension>
                            <extension>.png</extension>
                            <extension>.bmp</extension>
                        </restrictedExtensions>
                    </processor>
                </attachFile>
                <uiUpload>
                    <processor mode="on" type="Validations.Upload.ImageUploadMaxSize, Custom.Validations" patch:before="processor [@type='Sitecore.Pipelines.Upload.CheckSize, Sitecore.Kernel']">
                        <restrictedExtensions hint="list">
                            <extension>.jpg</extension>
                            <extension>.jepg</extension>
                            <extension>.png</extension>
                            <extension>.bmp</extension>
                    </restrictedExtensions>
                </processor>
            </uiUpload>
        </processors>

        <pipelines>
            <getMediaStream>
                <processor type="Validations.Compression.ImageCompression, Custom.Validations" />
            </getMediaStream>
        </pipelines>
        <settings>
            <setting name="Media.MaxImageSizeInDatabase" value="600KB" />    
            <setting name="Media.Resizing.Quality" value="72" />
        </settings>
    </sitecore>
</configuration>



宽度和高度为空值时出错 enter image description here

最佳答案

问题终于解决了。问题是我必须“解锁”jpegtran.exe 文件。就是这样。

enter image description here

关于compression - Sitecore 'getMediaStream' 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27952875/

相关文章:

algorithm - 证明 k 级流水线最多比非流水线快 k 倍

c# - 如何在不使用第 3 方 API 的情况下使用 C# 压缩文件?

c - 无损压缩算法是否在位级别上工作?

php - 使用 PHP ob_start() 与 Apache Deflate/Gzip 压缩内容?

continuous-integration - 如何保持 Sitecore 数据库一致?

powershell - ExpandProperty - 管道中缺少的对象

linux - tar:错误不可恢复:现在退出

asp.net - 请求验证 - 在 SiteCore 中如何以及为何禁用它?

Sitecore 一次从库中放置多张图片

gitlab - 如何从 GitLab CI 创建 Jira 任务?