Images into Qute Template - quarkus

Does anyone know how to insert images into qute template?
I tried to write something in my HTML like:
<img src="../../../resources/templates/imgs/test.jpg" alt=""/>
but always got exception:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
and a lot of symbols of image code.
And the same question if image is SVG format.

You shouldn't include images into the templates directory as otherwise they will get parsed by Qute as templates.
Just store the images in a directory outside of the templates directory. If you want them to be accessible as static resources, they should be in src/main/resources/META-INF/resources.
Note that you can also prevent Qute from parsing some files with quarkus.qute.template-path-exclude - https://quarkus.io/guides/qute-reference#quarkus-qute_quarkus.qute.template-path-exclude .
But I don't think that's what you want as in any case, your images need to be accessible as static content.

Works only variant with base64 : <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ........" alt=""/>

Related

Gatsby images - scaling and lazy loading images in markdown html

I have a lot of markdown files that I've imported into Contentful with images linked inside of them. The images link to external websites like Imgur for the source.
I'm trying to get the images to scale up and lazy load like you can do using the Gatsby Image API. The problem is that the images are all within the one html node due to how the markdown is processed.
The markdown is being set on the page using:
dangerouslySetInnerHTML={{ __html: body.childMarkdownRemark.html }}
Is what I'm trying to do possible? I feel like there is some way to chain Gatsby plugins to download the images locally from the html and then create nodes in GraphQL to handle this but I'm not sure. Ideally I don't want to have to change the markdown files to point to Contentful assets due to it not being easy to migrate to other solutions in the future.
Any help would be appreciated! Thanks

how to force Sphinx to show all the pages of project in sidebar?

I am trying to create a sphinx documentation for my project - using the rtd_sphinx_theme.
the problem is that the sphinx's side bar is showing only the content of the specific html page
and look like -
https://pasteboard.co/IfaVm32.png
and I want it to be like -
https://sphinxcontrib-fulltoc.readthedocs.io/en/latest/install.html
and contains links to other pages.
I tried to use sphinxcontrib-fulldoc, but then when I am trying to generate the html file I got an error that -
Reason: TypeError("make_toctree() got an unexpected keyword argument 'titles_only'")
I tried to change the rst-theme configurations (html_options) but its not works.
I did a make clean and make html and it still not works :\
someone knows how can I get it to work?

Rmarkdown and Pandoc templates - specifying paths to assets

I am attempting to create my own pandoc template for use with RStudio/Rmarkdown and HTML output. After some code snooping, google searches and trial/error I have a functional template that works as expected. I have included the template within an R package as well as my own custom function for calling html_document().
However, I am unable to determine the appropriate way to specify/reference local assets (e.g. images) I would like included within my pandoc HTML template. I have tried specifying the path relative to the pandoc template with no luck. I'm surmising that I need to provide an absolute path and I can get that from System.file(). For assets such as css files that are specified within the header, I can handle that as part of my custom call to html_document. In this case, however, I'm trying to specify a path within the HTML body and not sure how to elegantly include that within the pandoc template.

cannot load images into dompdf on same server?

Why cant i add images on my server to a pdf? I think it has something to do with the url structure, is it supposed to be different for this scenario?
currently its:
<img src="http://mywebsite.com/images/image.jpg">

How to serve static files over http

I'm following a tutorial on building a webpage in go. Everything in the tutorial is easy to grasp, but I'm trying to expand on it. Specifically, I'm trying to add some static files (pictures). I've been going through the go docs and came across FileServer and adding
http.ServeFile(w, r, "/home/jeff/web/foo.jpg")
in my handler I see an image being served but it's not using the template
<h1>{{.Title}}</h1>
<p>[edit]</p>
<img src="foo.jpg" alt="moooooo">
<img src="foo.jpg" alt="foooooo">
<div>{{printf "%s" .Body}}</div>
*I've tried giving the full path to the images too.
What I'm trying to do is get the image to occupy the html tags that I've placed so carefully in the template.
I want the image to appear where I tell them to, but get blank images where they should be. I'm not seeing any errors saying the file can't be found.
The way I think this should work (again no experience in this) is by telling the server I have this directory that houses some static files and whenever a template requests an image check here and if found serve it. Doesn't appear to be this simple. What am I doing wrong? How can I get this to work?
I'm using http.ListenAndServe(":8080", nil) in my main in other words I'm not using apache or some other web-server
The images should be served from a different URL path to the templates.
You need to define where the static files will be served from using something like:
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("/home/jeff/web/"))))
and then make sure the <IMG> source URLs are something like:
<img src="/static/foo.jpg" alt="moooooo">
Hope that helps.

Resources