- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已在网站的 .htaccess
文件中指定了以下属性:
AddOutputFilterByType DEFLATE image/svg+xml
DeflateCompressionLevel 9
Header append Vary Accept-Encoding
但是,我的 SVG 资源并未以压缩形式发送:
$ curl https://example.org/assets/svg/asset.svg --silent -H "Accept-Encoding: gzip,deflate" --write-out "${size_download}\n" --output /dev/null
152655
$ curl https://example.org/assets/svg/asset.svg --silent --write-out "%{size_download}\n" --output /dev/null
152655
我验证该资源 (asset.svg
) 是使用 Chrome 以 MIME 类型 image/svg+xml
发送的,但使用 Web 开发人员工具,此特定文件在发送到客户端时未经过压缩。
将其他 MIME 类型添加到 .htaccess
文件成功(例如,添加 text/html
压缩 HTML 资源)。
这似乎特定于 SVG 数据的处理方式。我还可以尝试什么或排除故障以使 SVG 压缩正常工作?
最佳答案
如果 Apache 不知道文件的 mime 类型(此处为 image/svg+xml),则需要具体告知(大多数 Apache 中不需要):
AddType image/svg+xml svg svgz
现在,当 Apache 知道文件类型时,只需添加以下内容即可缩小它:
AddOutputFilterByType DEFLATE image/svg+xml
有关更多信息,请参阅 https://httpd.apache.org/docs/2.4/mod/mod_deflate.html
关于.htaccess - 如何通过 Apache2 发送压缩(放气)的 SVG?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21356811/
我在启动时为我的 mac 应用程序进行时间分析,我不记得在雪豹中看到过这个类,但不能确定。有谁知道它是做什么用的? 最佳答案 这是 Lions 的新功能,用于保存和恢复窗口状态(如位置等)。它通过压缩
我有一些想法想要尝试与数据压缩相关,但我发现很难破译该标准在“现实生活中”如何应用的某些部分。我想查看一些示例压缩文件,以观察 block 的排列方式以及哈夫曼树的结构。 是否有任何工具可以帮助可视化
这个问题已经有答案了: python: read lines from compressed text files (4 个回答) 已关闭 8 年前。 我使用以下生成器以内存高效的方式逐行迭代给定的
我正在向 cloudfront CDN 发出请求并看到非常令人沮丧的行为。在 chrome 和 firefox 中,请求传递了正确的 accept-encoding:gzip, deflate hea
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 10 年前。 Improve thi
总结:我需要一个 PNG 编写器,出于各种原因我不得不从头开始。我不需要压缩图像数据,所以我使用无压缩 deflate 算法实现了 PNG。需要多个压缩 block 的图像渲染失败,似乎是因为它忽略了
是否有隐藏在 Internet 中的 ByteBuffers 方面的 gzip-deflating 库?允许我们推送原始数据然后提取缩减数据的东西?我们搜索了它,但只找到处理 InputStreams
我正在使用 zlib压缩文本数据流。文本数据以 block 的形式出现,对于每个 block ,deflate()被调用,flush 设置为 Z_NO_FLUSH .检索到所有 block 后,def
我已在网站的 .htaccess 文件中指定了以下属性: AddOutputFilterByType DEFLATE image/svg+xml DeflateCompressionLevel 9 H
我是一名优秀的程序员,十分优秀!