Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Jeffery24
Helper I
Helper I

Sharepoint images as base 64 not loading correctly.

Hi.

We need to utilise a dynamic image for one of our reports using the "Simple Image" visual.

Direct URLs didn't work for us so went down the route of Chris Webb's blog post:

https://blog.crossjoin.co.uk/2019/05/19/storing-large-images-in-power-bi-datasets/

In Chris's blog he uses a DAX measure to create the field the visual uses. But Simple Image doesn't support measures so I used a table in Powerquery to create a column then add that into the simple image visual.

Have created the dataflow and all works very well untill the image is a larger size and splits over multiple lines.

Capture.JPG

I added a some code provided by MarcelBeug to combine the rows based off the index order, in effect to mirror the Chris Webb Dax measure.

 

 

let
    Source = PowerBI.Dataflows(null),
    Workspace = Source{[workspaceName="WorkspaceName"]}[Data],
    DataflowID = Workspace{[dataflowName="KPI Logos"]}[Data],
    EntityID = DataflowID{[entity="Logos"]}[Data],
    FilterByAccount = Table.SelectRows(EntityID, each Text.Contains([Name], AccountName)),
    
    SortIndex = Table.Sort(FilterByAccount,{{"Index", Order.Ascending}}),
    BufferSortTable = Table.Buffer(SortIndex),
    #"Inserted Text Length1" = Table.AddColumn(BufferSortTable, "Length", each Text.Length([Pic]), Int64.Type), 
    CombinePic = Table.Group(#"Inserted Text Length1", {"Name"}, {{"PicCombine", each Text.Combine([Pic]), type text}}),
    #"Inserted Text Length" = Table.AddColumn(CombinePic, "Length", each Text.Length([PicCombine]), Int64.Type),
    AddLogo = Table.AddColumn(#"Inserted Text Length", "Logo", each "data:image/png;base64, " & [PicCombine]),
    FormatLogo = Table.TransformColumnTypes(AddLogo,{{"Logo", type text}})
in
    FormatLogo

 

 

But unfortunately the image only half fills. Should look like one on the left.

TestDesktop.jpg  Test.png

 

 

Any suggestions where I am going wrong or can a column not replicate the measure?

2 REPLIES 2
dax
Community Support
Community Support

Hi @Jeffery24 ,

As mentioned in above link, to solve image half-cut problem, you need to split the 64base into multiple rows, each of which are less than the 32766 character limit. So I suggest you could try link's suggestions, create measure to see whether it work or not.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Zoe,

 

Thanks for your quick reply.

I used a calculated column and the text combine as the original "Image by cloudscope" visual for the solution posted on the blog is not available anymore and the other visual Simple image” is not accepting the measure as an input.

My flow already breaks down a large image into multiple lines as per the blog code but now I need a solution to bring it back togetrher in a format a "working" visual can accept. Would you know of any alternatives to simple image that accept a measure?

Thanks.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors