web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Display a Base 64 image in CRM

(0) ShareShare
ReportReport
Posted on by

I have created a basic HTML file

<HTML>
    <HEAD>
        <TITLE>Display Image</TITLE>
        <META charset=utf-8>
    </HEAD>
    <img alt="" src="data:image/png;base64,R0lGOD...base64 code" />
</HTML>

If I save the file to my desktop, then double click it the webpage opens in IE and displays a logo.

If I now add this as a webresource within Dynamics CRM the logo displays as a black square with a white cross in it - whats going on?

All I am trying to do is read the Base64 from a related entity and as the data in the entity changes display the related image.

As always any help appreciated.

Matt

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Figured it partly out, I was editing the webresource directly in CRM and then saving it; I hadn't noticed that it was adding a Body tag in and because of this displayed the black box and white cross.  Creating the file in notepad and uploading that to CRM the logo is displayed as expected.

    Now I have some code:

                       var fileContents = "data:image/png;base64," + photodata;

                       var img = document.getElementById("WebResource_img");

                       img.src = fileContents;

    This should upload the latest image when the record changes, all that happens is the existing logo disappears and is not replaced.

    I've outputted the img.src as a string prior to updating it; now it is a path to the image as a file within CRM itself and after updating the string through the above code it it is set to the string in the original file.

    I'm  a little lost with what it is doing.

    Matt

  • Suggested answer
    StefanS365 Profile Picture
    3,575 Most Valuable Professional on at

    Here is a post with the solution: How to Display Image ... on Web Client In Dynamics 365

    community.dynamics.com/.../how-to-display-image-saved-using-pen-control-on-web-client-in-dynamics-365

  • Community Member Profile Picture
    on at

    Hi Stefan,

    The code is very similar to what I had prior to creating a HTML webresource, however, adding the above as is goes through the motion - at least it doesn't error - but no image is displayed.

    Regards,

    Matt

  • Suggested answer
    Flydancer Profile Picture
    1,332 on at

    If it's a filepath / URL you don't have to add "data:image/png;base64,", just set the path as src

  • Community Member Profile Picture
    on at

    Hi,

    No its the Base64 that I have for the image and trying to display that.

    Currently only way to display an image is to upload the image as a webresource - but as soon as I update the source for that image, it dissapears and no new mage is displayed.

    Matt

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans