Giter Site home page Giter Site logo

Comments (6)

lizkes avatar lizkes commented on August 23, 2024

更新,通过检查页面元素发现,padding-bottom的值是NAN
snipaste_20200911_014148

问题就出在这里

const ratio = (file.image.height / file.image.width) * 100
return `<div class="image-wrapper" style="width: 100%; height: 0; padding-bottom: ${ratio}%; position: relative;">

from onedrive-cf-index.

spencerwooo avatar spencerwooo commented on August 23, 2024

@lizkes 方便的话可以分享一下你的图片吗?我想看一下什么情况下 OneDrive 的图片获取不到长宽。还有应该很容易修好,但是我最近不太有时间,所以如果你方便的话可以直接发个 PR 我后面 merge 就好了。🧡

from onedrive-cf-index.

lizkes avatar lizkes commented on August 23, 2024

原因找到了,是因为微软的API返回的image对象为空,根据官方文档的解释:如果该服务无法确定图像的宽度和高度,图像资源可能为空,看来需要加入对象为空情况下的处理逻辑。
我的图片存放在这里,所有图片都有这个问题。
顺便一提我使用的是世纪互联版onedrive。

snipaste_20200911_020923

from onedrive-cf-index.

lizkes avatar lizkes commented on August 23, 2024

可以用请求缩略图的API来获取宽度跟高度,从而得到ratio,我尝试写一个PR出来.

from onedrive-cf-index.

lizkes avatar lizkes commented on August 23, 2024

Done

from onedrive-cf-index.

Micraow avatar Micraow commented on August 23, 2024

现在还是有这个问题,我的图片是一个gif图片。

from onedrive-cf-index.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.