Image not Loading in HTML file generated by azure function - python-3.x

I am trying to embed an image inside HTML which is generated by an azure function. when I run it in localhost I am able to see the image, but when I convert that to an azure function it throws a broken thumbnail image.iam using matplotlib to save the plot
plt.savefig(f'{basepath}/plot.png')
this will save it to a temporary path and then I am using it inside my HTML content
<div class="image">
<img src="""f'../{basepath}/plot.png'""">
</div>
on inspecting the page also iam able to see the correct path, though not the image

converting the image to a base encoded version
encoded = base64.b64encode(tmpfile.getvalue()).decode('utf-8')
and calling that inside the HTML worked for me
<img src="""f'data:image/png;base64,{encoded}'""">

Related

NodeJS.Readablestream to DOM?

I have a NodeJS.Readablestream which is a png image
How do I append it to dom? I'm trying to do this in the browser. I can't just add it to the <img> since it only has src="" which is supposed to be an url.

Markdown: How to resize image defined with a base64 data uri

In markdown, I would like to embed a base64 image data uri.
![description](data:image/png;base64, --base64 png--)
Is there any way to resize the rendered image in markdown?
As per this answer, it is allowed and encouraged to use HTML within markdown. So you can embed and resize a base64 image using the img tag in HTML by adding the data uri in the src attribute as follows.
<img width="20" height="15" src="data:image/jpeg;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="/>

Nuxtjs including images from assets using the content module

I am trying to use the nuxt.js Nuxt.js content module. Is there a way to display images we refer to in our blogpost.md file? I know that we can put images in the front matter, but I want the create of the articles to put images inside their created .md file. Lets say we have a file:
-- start of .md file --
# some text
some description
![Image of test](../../assets/images/test.jpg)
![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)# some text
some description
-- end of .md file --
I end up seeing the image that is linked using https. But the other image is not displayed?? When checking the page I see an <img> tag is created, but no image to be seen...
When I check the structure using any other markdown editor, I see the image.
Including links to images does display images. But I need to include locally stored images.
any help greatly appreciated
Partially solving the issue, some images can be added using metadata (like cover images), those cannot be added within the content itself, just above or bellow actual content.
---
title: Sample
image: test.jpg
---
Here the markdown (without images)
In the view you can render that image after or before the content using something like:
<img :src="require(`~/assets/images/${ page.image }`)">
<nuxt-content :document="page"/>

Gatsby replace image by base64 string in html but still serves it in javascript

I include some small images in my Gatsby website. The resulting html uses base64 strings which is fine. For some reason Gatsby includes exactly the same base64 image strings in component---src-pages-index-js-89ae02357f7d97fc84f9.js.
<a key={i} rel="noopener noreferrer" target="_blank" href={"http://www.webworkers.io"}><img
alt={`${i} logo`}
src={require(`./${i}.png`)}/></a>
Can I change this behaviour ?

j2me Lwuit form images from RSS feeds are not being loaded correctly

I have a LWUIT form in my j2me based application. I am getting my data through RSS Feeds(including image path). Now i want to show the images through RSS feeds image path in my LWUIT Form. I am using HTMLComponent for that purpose. The html based text is loading fine but the images are not being shown. Following is my code snippet.
HTMLComponent htmlComp = new HTMLComponent();
htmlComp.setPreferredSize(new Dimension(300,300));
String imagePath=myItem.getImagePath().trim();
htmlComp.setShowImages(true);
String myHtml="<b>Hello</b> <br/> <img src= \""+imagePath+"\" /> ";
System.out.println(myHtml);
htmlComp.setHTML(myHtml,null,null,false);
addComponent(htmlComp);
The image path is like "http://toffeetv.com/wp-content/uploads/2012/06/f_swan-150x150.jpg".
Why the images are not being shown? Can anybody help me with an appropriate code example?
The HTML Component accepts a base URL as one of its arguments to that method. Just set the URL to the appropriate path and it should work as expected.

Resources