现在我使用Dianoga(https://github.com/kamsar/Dianoga)进行图像压缩。
这个工具用于png和jpg / jpeg文件,PNG文件工作正常。但是,如果我上传JPG文件,上传工具框就像截图一样冻结。
这是执行行。
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文件已更新,但没有压缩过程。日志说,
"错误无法运行' getMediaStream'用于' / sitecore /媒体库/ Images / satellite-westtibet'的管道。将使用原始媒体数据"
这是我在/ 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>
宽度为Width and Height 的错误
答案 0 :(得分:0)
最后解决了这个问题。问题是我必须&#34; 取消阻止&#34; jpegtran.exe文件。那就是它。