cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SimonaB
Frequent Visitor

Image not loading in Power Portal

Can anyone guide me how to put a picture in a portal without storing it in a blob? I tried this method

<script>
    function toBase64(str) {
        if (!str) return null;
        var uarr = new Uint8Array(str.split(',').map(function (x) { return parseInt(x); }));
        return btoa(String.fromCharCode.apply(null, uarr));
    }
 
    window.addEventListener('load', function () {
      document.querySelectorAll('img[data-entityimage]').forEach(function (img) {
          var data = img.dataset && img.dataset.entityimage;
          var base64data = data ? toBase64(data) : null;
          if (base64data) {
              img.src = 'data&colon;image/jpeg;base64,' + base64data;
          }
      });
    });
 
  </script>
 
I tried using this function and render it
SimonaB_0-1656686144625.png

 

but I got this mistake : Liquid error: Object of type 'Adxstudio.Xrm.Web.Mvc.Liquid.ImageDrop' cannot be converted to type 'System.Collections.IEnumerable'. when loading the picutre in the portal.

 

Anyone know what to do since I'm very new to Portals, i would apricate any help, thank you 🙂 

0 REPLIES 0

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,257)