-
Notifications
You must be signed in to change notification settings - Fork 68
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
Remote image url failed to load. #415
Comments
I'm not sure Mobi supports remote images at all. In #333, asciidoctor-epub3 was fixed to pass URLs to EPUB. Mobi is created from EPUB using KindleGen and looks like the latter doesn't support remote URLs. We could add some hacks like "if we are producing Mobi, download remote resource and use that". The problem is that is isn't very clear when to download. Should we do it on each and every conversion? Or we should cache file? But when to re-download it? |
Thanks for the quick reply. Is it possible, whenever a URL is provided we download the images from the URL and put in a temporary folder or cache then read the images from there to create the Mobi and delete the cache after converting. I think it would make sense to download the images on every conversion. |
We should not reinvent the wheel and just implement this logic: https://docs.asciidoctor.org/asciidoc/latest/directives/include-uri/ |
Hmm... Looks like we already can do that:
@rshiva does this work for you? Note that you cannot use SVG images because Mobi doesn't support that. |
The logic to fetch a remote image, and to even cache it, is already provided by Asciidoctor core. See this method: https://github.com/asciidoctor/asciidoctor/blob/main/lib/asciidoctor/abstract_node.rb#L322-L334 The downside of that method is that it returns the image as a data URI instead of as a File reference. However, you can find a different implementation in Asciidoctor PDF that returns a temporary file path: https://github.com/asciidoctor/asciidoctor-pdf/blob/main/lib/asciidoctor/pdf/converter.rb#L4240-L4259 Suffice to say, this is a solved problem in Asciidoctor. It's just a matter of reusing the code which is already available. |
Indeed, this is one approach that leverages the logic I linked to in Asciidoctor core. If you prefer to have it add the image files to the manifest, then you would need the code from Asciidoctor PDF. |
Yep, there are some downsides using |
Thanks @mojavelinux and @slonopotamus this worked |
asciidoctor-epub3 no longer support producing MOBI/KF8, see #458. |
Asciidoctors,
I'm unable to generate/view the image from a remote URL while generating the Mobi. Whereas it works for asciidoctor when converting adoc to HTML
Code look something like this
Am I missing something? Please guide I'm totally new to Asciidoctor. This #333 issue says remote URL issue is resolved
The text was updated successfully, but these errors were encountered: