css 新的SVG文件没有显示在WordPress站点上- 404错误

q5lcpyga  于 2022-12-27  发布在  WordPress
关注(0)|答案(3)|浏览(157)

我管理一个WordPress网站(更新而不是开发)。我们有一个显示房间功能的区域。这些都是由每个功能的单独SVG文件组成的。该网站是为文件设置的,所有文件都显示没有问题(在媒体库中和在网站上的功能框中的页面上)。
我们在聊天室中添加了一些额外的功能,所以我让我的自由职业者创建一些额外的SVG文件添加到功能框中,并向他提供当前文件以确保连续性。我安装了安全SVG,使我能够上传它们,它们上传,但是在媒体库中它们没有缩略图,当我跟踪网址时出现了404错误。当我试图将它们添加到功能框中时,他们进入,但在页面上,他们显示为一个断开的链接。
这是我的一个新文件的SVG代码-有人能帮我看看吗,看看里面有什么可能导致这个问题?我对SVG一无所知,我以前从未使用过它们-我可能看到尺寸不正确,因为我们当前的文件是500 x 500,但自由职业者向我保证它们设置为相同的尺寸?

<svg id="Layer_4" data-name="Layer 4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 493.32 336.43"><defs><style>.cls-1,.cls-2,.cls-3{fill:none;stroke:#000;stroke-width:5px;}.cls-1,.cls-2{stroke-linecap:round;}.cls-1{stroke-miterlimit:10;}.cls-2,.cls-3{stroke-linejoin:round;}</style></defs><title>Cup_and_Kettle</title><path class="cls-1" d="M33.77,370.17q-.52,6.9-.53,14c0,47.68,18.1,89.39,45.14,112.22h95.08c27-22.83,45.15-64.54,45.15-112.22q0-7.11-.53-14H48.3" transform="translate(-1.5 -162.47)"/><path class="cls-1" d="M219.23,384.15c0,.35,0,.69,0,1,0,33.06-8.71,63.24-23.06,86.25a55.37,55.37,0,0,0,11.32,1.17c27.58,0,49.94-20.08,49.94-44.86C257.44,406.61,241.15,388.89,219.23,384.15Z" transform="translate(-1.5 -162.47)"/><path d="M90.31,362.58a4.38,4.38,0,0,1-1.33-.2c-4.38-1.4-10.41-3.91-12.18-9.66-1.91-6.19,2.19-12,6.15-17.52,6.71-9.42,8.81-13.8,2.52-19.33a5.12,5.12,0,0,1-.62-6.93,4.45,4.45,0,0,1,6.53-.65c13.77,12.07,4.51,25.08-1,32.85-1.8,2.52-5.14,7.22-4.74,8.52,0,0,.62,1.57,6,3.28a5,5,0,0,1,3.12,6.13,4.69,4.69,0,0,1-4.45,3.51" transform="translate(-1.5 -162.47)"/><path d="M128,362.58a4.49,4.49,0,0,1-1.34-.2c-4.38-1.4-10.4-3.92-12.17-9.66-1.91-6.19,2.19-12,6.15-17.52,6.7-9.42,8.81-13.81,2.51-19.33a5.14,5.14,0,0,1-.62-6.93,4.47,4.47,0,0,1,6.54-.66c13.76,12.08,4.51,25.08-1,32.85-1.8,2.53-5.14,7.23-4.74,8.53,0,0,.62,1.56,6,3.28a5,5,0,0,1,3.11,6.13,4.67,4.67,0,0,1-4.44,3.51" transform="translate(-1.5 -162.47)"/><path d="M163.86,362.58a4.49,4.49,0,0,1-1.34-.2c-4.37-1.4-10.4-3.92-12.17-9.66-1.91-6.19,2.19-12,6.15-17.52,6.7-9.42,8.81-13.81,2.51-19.33a5.14,5.14,0,0,1-.62-6.93,4.47,4.47,0,0,1,6.54-.66c13.77,12.08,4.51,25.08-1,32.86-1.8,2.52-5.14,7.22-4.74,8.52,0,0,.62,1.56,6,3.28a5,5,0,0,1,3.11,6.13,4.67,4.67,0,0,1-4.44,3.51" transform="translate(-1.5 -162.47)"/><path class="cls-2" d="M4,496.4H373a159.93,159.93,0,0,0-18.15-241.21,102.18,102.18,0,0,0-189.83-1.72" transform="translate(-1.5 -162.47)"/><path class="cls-3" d="M407.93,437.67c46.37,6.05,76.34-26.72,83.43-74A86.81,86.81,0,0,0,371,271.19" transform="translate(-1.5 -162.47)"/><path class="cls-3" d="M259.62,190a102.06,102.06,0,0,1,32.58,5.32c.06-.74.1-1.49.1-2.25a28.08,28.08,0,0,0-56.15-.36A102.48,102.48,0,0,1,259.62,190Z" transform="translate(-1.5 -162.47)"/><polyline class="cls-2" points="316.25 92.01 92.71 92.01 157.46 136.47"/></svg>

为了进行比较,这是一个工作文件:

<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><defs><style>.cls-1{fill:none;stroke:#1d1d1b;stroke-miterlimit:10;stroke-width:5px;}</style></defs><title>pillow</title><path class="cls-1" d="M80.79,157.24c-14.57,0-26.87-11.51-27.09-26.08a26.51,26.51,0,0,1,29.71-26.73C96.79,106,106.7,117.7,106.7,131.17v.06c46.52-4.78,93-11.59,139.81-12.21,39-.52,77.74,5.12,116.45,9.1l30.34,3.11v-.06c0-13.47,9.91-25.16,23.29-26.74A26.52,26.52,0,0,1,446.12,134c-1.58,13.38-13.27,23.28-26.74,23.28h-.07l7.4,46.58a295,295,0,0,1,0,92.36l-7.4,46.58h.07c13.47,0,25.16,9.9,26.74,23.28a26.52,26.52,0,0,1-29.53,29.53C403.21,394,393.3,382.3,393.3,368.83v-.06c0,1-61.53,6.78-67.49,7.39-23.37,2.4-46.81,4.34-70.31,4.75-38.9.67-77.48-4.82-116.1-8.78l-32.64-3.36a.05.05,0,0,0-.06.06c0,13.47-9.91,25.16-23.29,26.74A26.52,26.52,0,0,1,53.88,366c1.58-13.38,13.27-23.28,26.74-23.28h.07l-7.27-46.57a294.23,294.23,0,0,1,.24-92.34l7.52-46.61Zm34.74,25.52s-17.67,29.45-17.67,65.77,17.67,65.76,17.67,65.76,17.67-29.44,17.67-65.76S115.53,182.76,115.53,182.76Z"/></svg>

否则我就被难住了--还有什么别的想法吗?为什么老节目和新节目没有?
感谢你的帮助,谢谢你:)

kqlmhetl

kqlmhetl1#

根据我自己刚才处理这个问题的经验,并且考虑到您的站点上已经有SVG文件。
首先检查SVG文件是否工作正常-例如,如果您在文件资源管理器/ Windows资源管理器中双击该文件,它们是否可以正常打开?或者您是否可以用其他方式预览它们?如果可以,则文件没有问题。
对我有用的SVG不显示的修复可能对你有用-我需要设置我上传的单个SVG文件的权限,因为它们返回了一个错误(403禁止错误,这是因为权限不足以让Web用户看到它们)。
如果您使用FTP工具,或者您的Web主机的文件管理器工具,您需要设置权限以提供对新上传文件的read访问(相当于Linux上的644)。
不,我不认为你的问题是离题的。

wrrgggsh

wrrgggsh2#

我遇到过一个SVG文件返回404的类似问题。最后,这是一个权限问题,虽然它显示为664,但我再次将其设置为664,404错误消失了。不幸的是,我无法解释为什么忽略了权限。

noj0wjuj

noj0wjuj3#

我使用SVG Sanitizer Test来清理SVG,它看起来不错

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" id="Layer_4" data-name="Layer 4" viewBox="0 0 493.32 336.43">
  <defs>
    <style>.cls-1,.cls-2,.cls-3{fill:none;stroke:#000;stroke-width:5px;}.cls-1,.cls-2{stroke-linecap:round;}.cls-1{stroke-miterlimit:10;}.cls-2,.cls-3{stroke-linejoin:round;}</style>
  </defs>
  <title>Cup_and_Kettle</title>
  <path class="cls-1" d="M33.77,370.17q-.52,6.9-.53,14c0,47.68,18.1,89.39,45.14,112.22h95.08c27-22.83,45.15-64.54,45.15-112.22q0-7.11-.53-14H48.3" transform="translate(-1.5 -162.47)"></path>
  <path class="cls-1" d="M219.23,384.15c0,.35,0,.69,0,1,0,33.06-8.71,63.24-23.06,86.25a55.37,55.37,0,0,0,11.32,1.17c27.58,0,49.94-20.08,49.94-44.86C257.44,406.61,241.15,388.89,219.23,384.15Z" transform="translate(-1.5 -162.47)"></path>
  <path d="M90.31,362.58a4.38,4.38,0,0,1-1.33-.2c-4.38-1.4-10.41-3.91-12.18-9.66-1.91-6.19,2.19-12,6.15-17.52,6.71-9.42,8.81-13.8,2.52-19.33a5.12,5.12,0,0,1-.62-6.93,4.45,4.45,0,0,1,6.53-.65c13.77,12.07,4.51,25.08-1,32.85-1.8,2.52-5.14,7.22-4.74,8.52,0,0,.62,1.57,6,3.28a5,5,0,0,1,3.12,6.13,4.69,4.69,0,0,1-4.45,3.51" transform="translate(-1.5 -162.47)"></path>
  <path d="M128,362.58a4.49,4.49,0,0,1-1.34-.2c-4.38-1.4-10.4-3.92-12.17-9.66-1.91-6.19,2.19-12,6.15-17.52,6.7-9.42,8.81-13.81,2.51-19.33a5.14,5.14,0,0,1-.62-6.93,4.47,4.47,0,0,1,6.54-.66c13.76,12.08,4.51,25.08-1,32.85-1.8,2.53-5.14,7.23-4.74,8.53,0,0,.62,1.56,6,3.28a5,5,0,0,1,3.11,6.13,4.67,4.67,0,0,1-4.44,3.51" transform="translate(-1.5 -162.47)"></path>
  <path d="M163.86,362.58a4.49,4.49,0,0,1-1.34-.2c-4.37-1.4-10.4-3.92-12.17-9.66-1.91-6.19,2.19-12,6.15-17.52,6.7-9.42,8.81-13.81,2.51-19.33a5.14,5.14,0,0,1-.62-6.93,4.47,4.47,0,0,1,6.54-.66c13.77,12.08,4.51,25.08-1,32.86-1.8,2.52-5.14,7.22-4.74,8.52,0,0,.62,1.56,6,3.28a5,5,0,0,1,3.11,6.13,4.67,4.67,0,0,1-4.44,3.51" transform="translate(-1.5 -162.47)"></path>
  <path class="cls-2" d="M4,496.4H373a159.93,159.93,0,0,0-18.15-241.21,102.18,102.18,0,0,0-189.83-1.72" transform="translate(-1.5 -162.47)"></path>
  <path class="cls-3" d="M407.93,437.67c46.37,6.05,76.34-26.72,83.43-74A86.81,86.81,0,0,0,371,271.19" transform="translate(-1.5 -162.47)"></path>
  <path class="cls-3" d="M259.62,190a102.06,102.06,0,0,1,32.58,5.32c.06-.74.1-1.49.1-2.25a28.08,28.08,0,0,0-56.15-.36A102.48,102.48,0,0,1,259.62,190Z" transform="translate(-1.5 -162.47)"></path>
  <polyline class="cls-2" points="316.25 92.01 92.71 92.01 157.46 136.47"></polyline>
</svg>

相关问题