odoo base64 image not working on website for custom module - base64

I am creating a custom module. Where in the backend user will be able to upload background image of a section. I have a binary field in the backend for that.
But for some reason the image is not showing. Here is the line of qweb code I am using -
<div id="comments1" class="parallax-section" t-att-style="'background-image: url(data:image/png;base64,'+res_company.website_logo_img+');'">
This loads the data in binary format incompatible way.
Following is the screenshot when I first load the webpage and image not shows-
Google developer Tools inspect element view
Following is the screenshot when I just take than line in editable mode and hit enter. The image shows nice and clear:
Google developer Tools inspect element view
Can anyone tell me what is the problem?

Related

Posts text and image to pdf in react

I'm trying to create a blog post website where anyone can post anything. And also any user can download any post in one click. So is it possible to implement a button for download whole specific post content except side menus and comment in react.
I assume you want to give the user the ability to download a blog post (react component) as pdf.
Check out this tutorial by Robin Wieruch
What you basically do is create a ref for your component and then convert it to a canvas with html2canvas npm package, then to image data.
The image data is added to a pdf with pdfjs npm package and downloaded.
See the link for details.

How to render raw HTML block from Rich Text Editor after Axios request?

So my backend is Django with Django Rest API and there I create my blog posts which are rendered in Nuxt page using "v-html" directive.
Problem 1: Uploaded images inside of Rich editor in Django is not rendering in Nuxt (Aim is to be able to add pictures in the middle of blog post)
Problem 2: Codeblocks (html code block with markdown) inserted in Rich Editor is being rendered in Nuxt without any styles, whereas the same codeblock being inserted as a Nuxt data object is rendered with styles. (Aim is to be able to insert codeblocks in rich editor so its rendered in Nuxt with styles)
As a rich text editor in Django Admin I use Django-Trumbowyg.
I searched everywhere, however couldn't find the proper solution! All the solutions I digged out in internet are "workarounds" and from my point of view its not the way it is supposed to be. I would more than glad if you could provide a reference if it's a duplicate or help me to find out a solid solution.
:)

Importing knowledge base from MD File

How can we fetch the QnA Pair from the URL which runs JS and then renders the DOM? The file is in markdown format and renders into HTML via running JS.
I came to know that the QnA Maker only searches the HTML contents. I want to have QnA pairs from a markdown file. For example:
This works in QnA: https://github.com/gulpjs/gulp/blob/master/docs/FAQ.md
While this not: https://raw.githubusercontent.com/gulpjs/gulp/master/docs/FAQ.md
I am able to get the content as a second one from a page, but it's of no use as QnA doesn't support raw markdown. It supports in the form of HTML and the page I am requesting renders it after running JS.
I tried requesting with Postman too and body only contains Please enable JS and the same is happening with QnA.

Download dynamically generated pdf from using selenium

So I'm trying to download pdf files from an ancient internal web system. I put in a request and based on my request parameters, it generates a new pdf and shows it in a new window. Since the pdfs are generated dynamically, there is no real url I could download.
I'm trying to figure out how I would download the file after it has generated and opened up in the new window.
The pertinent part of the page's source seems to be this:
<body onload="document.FormForDownload.submit();">
<form name="FormForDownload" method="get" action="./download.pdf" target="iframePDF">
<iframe name="iframePDF"></iframe>
</form>
</body>
I'm open to using the requests library or urllib or anything people suggest. ANy ideas? Working in python btw.
If I suppress chrome's own PDF viewer to get it to automatically download the pdf, I get a page that looks like this:
Clicking the open button will give me this page:
This is because the url generated is one time use only, to generate the url again, I have to request the pdf again.

Episerver Thumbnails for jpegs are getting a 404

In Episerver 11, the thumbnails for jpegs are broken. In the media library, they display as broken images:
And I see this in the browser tools:
Failed to load resource: the server responded with a status of 404 ()
On the actual url
https://mysite.mydomain.com/episerver/CMS/Content/siteassets/heros/myimage.jpg,,26/Thumbnail?epieditmode=False?1527614597161
On an actual web page and in the Image editor, they display fine. Not entirely sure how the thumbnail system works.
Make sure your thumbnails are saved as png's.
I had the same problem, due to a third-party library for image resizing.
It turns out Episerver (CMS version 9.12), always wants to save the thumbnail for an image in a png format.
Run the scheduled job "Clear Thumbnail Properties" in admin
From the documentation
You can clear generated thumbnail images in the Products list and
Media list views and add them again with the Clear Thumbnail
Properties job. Run this job manually if you experience problems with
refreshing thumbnails, such as on the website and BLOB-supported
content.

Resources