doutong7216
2014-03-19 01:20
浏览 34
已采纳

Silverstripe上传和隔行扫描图像

I am trying to navigate the Silverstripe Class definition for GDBackend and am having trouble setting the interlace value.

I am currently setting the quality in _config.php with:

config::inst()->update('GDBackend', 'default_quality', 60);

So i then tried to set the interlacing with the following:

config::inst()->update('GDBackend', 'image_interlace', 1);

Is this the correct method to setting these values? It is hard to know with all of the deprecation going on in this class.

When the image is uploaded the filesize is reduced - so the quality appears to be set correctly but the interlacing setting has no effect.

Also, the logs are free of any errors.

------------------- UPDATE:

After consulting the Silverstripe IRC channel I have moved the config settings into the yml with the following.

GDBackend: default_quality: 60 image_interlace: 1

Images are still not interlaced after upload.

I am using this tool to test for interlacing.

------------------- CONCLUSION:

It turns out that these settings are not a part of the upload processing and only apply to images generated by the CMS. For example images prefixed with something like SetWidth400-image-name.jpg will be interlaced and optimized as instructed by the yml config.

I will be looking into extending the upload module to give the user option to interlace images at the point of upload.

Thanks to colymba for his help clearing this up for me.

图片转代码服务由CSDN问答提供 功能建议

我正在尝试浏览 GDBackend 并且无法设置隔行扫描值。

我目前正在设置质量 在 _config.php 中:

config :: inst() - &gt; update('GDBackend','default_quality',60); < / code>

因此我尝试使用以下内容设置隔行扫描:

config :: inst() - &gt; update ('GDBackend','image_interlace',1);

这是设置这些值的正确方法吗? 很难知道这个类中所有的弃用。

当上传图像时,文件大小减少了 - 所以质量似乎设置正确但隔行扫描设置有 没有效果。

此外,日志没有任何错误。

------------ -------更新:

咨询了Silverstripe IRC频道后,我已将配置设置移动到yml中,如下所示。 \ n

GDBackend: default_quality:60 image_interlace:1

上传后图像仍未隔行扫描。

我正在使用此工具来测试隔行扫描。

-------------------结论:

事实证明 这些设置不是上传处理的一部分,仅适用于CMS生成的图像。 例如,以 SetWidth400 -image-name.jpg为前缀的图像将按照yml配置的指示进行隔行扫描和优化。

我将考虑扩展 上传模块为用户提供了在上传点交错图像的选项。

感谢colymba的帮助,为我清除了这一点。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题