You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I always got undefined when invoking the getBlob method. Is there something wrong? Is there a better way to get images? Any help would be appreciated. Thanks
The getBlob() method requires an absolute path, and it must start with a leading slash. The path given by resources.assets, however, can be, and often is, relative to the package document (the .opf file).
book.resources.assets.find(x=>x.type==='image/jpeg').href// => "images/9780316000000.jpg"book.archive.getBlob('images/9780316000000.jpg')// `undefined`book.archive.getBlob('/OPS/images/9780316000000.jpg')// works
To work around this, you need to first get book.container.packagePath. Then resolve the paths of the assets relative to this path. And make sure it starts with a leading slash. See also #1084, which is similar to this.
Hi,
I want to get the images of the ePub file. My code is like
However, I always got
undefined
when invoking thegetBlob
method. Is there something wrong? Is there a better way to get images? Any help would be appreciated. Thankscc @fchasen
The text was updated successfully, but these errors were encountered: