Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

图片行内属性宽高均为 0 #551

Closed
jeff-wangzhen opened this issue Jun 27, 2022 · 7 comments
Closed

图片行内属性宽高均为 0 #551

jeff-wangzhen opened this issue Jun 27, 2022 · 7 comments

Comments

@jeff-wangzhen
Copy link

Describe the bug

偶现异常,图片不显示,请求是成功了的,去掉这2 个行内属性能看到图片,就是尺寸位置可能不太对劲。
image

To Reproduce

不能稳定复现

Expected behavior

如果宽高计算有问题,能让浏览器默认计算吗,就给个默认宽度或者高度,然后浏览器默认等比计算就行

Screenshots
见上图

Desktop (please complete the following information):

  • OS: macos
  • Browser chrome dev
  • Version 105.0.5137.4

Additional context

@jeff-wangzhen
Copy link
Author

不确定是不是 vieweerjs 的问题,我用的是 v-viewer,我先给那边提一下

@jeff-wangzhen
Copy link
Author

jeff-wangzhen commented Jul 5, 2022

mirari/v-viewer#244

还是得在这边提一下。。

而且发现,如果出现了这种情况,换图片(即使重新请求)好像也是没有用的,要刷新页面才行,估计是某段初始化的代码有点问题

@jeff-wangzhen jeff-wangzhen reopened this Jul 5, 2022
@fengyuanchen
Copy link
Owner

这种情况应该是 image 元素触发了 load 事件,但是 image.naturalWidth/Height 却都是 0。检查一下原图片看看。

@jeff-wangzhen
Copy link
Author

这种情况应该是 image 元素触发了 load 事件,但是 image.naturalWidth/Height 却都是 0。检查一下原图片看看。

请问怎么检查呢,图片本身肯定没问题,因为去掉这 2 个行内属性能显示出来

@fengyuanchen
Copy link
Owner

如果无法复现,也就无法修复。估计只是该浏览器版本不稳定导致的问题。

@Frankisgek
Copy link

Frankisgek commented Dec 13, 2022

@jeff-wangzhen I ran into this issue as well, it might be caused by loading="lazy" on the source image check for the solution #403

@jeff-wangzhen
Copy link
Author

@jeff-wangzhen I ran into this issue as well, it might be caused by loading="lazy" on the source image check for the solution #403

@Frankisgek Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants