Skip to content
Franco Mussopower pages
Desk with lamp, pens and pencils
Photograph · Faraaz Zuberi / Unsplash
Guide No.034
TutorialConfiguration · Multimedia

Get full resolution images in your Power Pages Lists

This tip originated from a request for help on LinkedIn.

Level
03CustomiseStage 3 of 4
Read
5 min
Includes
3 snippets
Written
Oct 2023

Actually, this is expected behaviour for Dataverse Image columns. Regardless of what we set as the maximum file size, Dataverse stores the original full resolution image and also an optimised thumbnail, resized and cropped to 144px x 144px.

For performance reasons, what gets output in Lists is the thumbnail. The URL will look something like this. (note that it includes the logical name of the table, the image column and the GUID of the record it’s related to)
/Image/download.aspx?Entity=musdyn_track&Attribute=musdyn_artwork&Id=fe707d78-999d-ed11-aad1-0022481b5104&Timestamp=638103486073835852

All that we need to do to receive the full resolution / full size image is to append &Full=true to that URL, like so:
/Image/download.aspx?Entity=musdyn_track&Attribute=musdyn_artwork&Id=fe707d78-999d-ed11-aad1-0022481b5104&Timestamp=638103486073835852&Full=true

What we’ll cover in this post is how to use jQuery to amend that link in the list output to request the full resolution image.

Step 1 – The selector

Usually I get my code working in browser dev tools first (an easy place to test out selectors etc in real time without having to commit the code, clear the cache, etc.) and then I’ll combine with the correct trigger once I’m happy (step 3).

As with many of my jQuery and CSS tips, I’ll make use of data attributes to target the elements I want to work on.
In plain English, I need my selector to target:

Images within the rows of the body of the table within my grid (list or subgrid) whose source contain ‘Image/download.aspx’ but do not contain ‘&Full=true’

Here is the selector:

table[role="grid"] tbody img[src*="Image/download.aspx"][src!="&Full=true"]

Step 2 – Perform the URL change on the image URLs

Now I’ll write a function to loop over each of the results returned by the selector, using jQuery’s .each. Here’s how the empty function looks:

Empty function to select thumbnail images from listJavaScript
function getFullResImages() {
    $('table[role="grid"] tbody img[src*="Image/download.aspx"][src!="&Full=true"]').each(function () {
        // Add functionality here
    });
}

To complete that, we just need to add the steps to perform on each of those images…

I use $(this) to refer to the current image in the loop, and I need to get its src attribute. Knowing I’ll need a way to refer to that shortly, I store it in a variable.

Finally, I want to append text to the end of the existing value. In jQuery / JavaScript, I simply say set it to it’s current value + the new text like so:

var src = $(this).attr('src');
$(this).attr('src', src + '&Full=true');

Our full function looks like this:

Get Full Res Images function without triggerJavaScript
function getFullResImages() {
    $('table[role="grid"] tbody img[src*="Image/download.aspx"][src!="&Full=true"]').each(function () {
        var src = $(this).attr('src');
        $(this).attr('src', src + '&Full=true');
    });
}

Step 3 – Trigger the function on load / re-load of the list

In case you haven’t added JavaScript to lists before, it’s worth knowing the correct event to use. You may be tempted to go with document ready. There are a few quirks to be aware of… window.load is more suitable due to lists loading asynchronously and also that lists reload each time we sort, filter, search or page through results so we need to listen for additional ‘loaded’ events beyond the page load.

Instead, on window loaded, we’ll add an event listener for each time the list loads / reloads so we’re covered in all scenarios.

To make this snippet reusable, I’m not referring to a specific list by ID. Instead, I’m targetting classes that will work with all lists / subgrids. Here’s the final snippet:

Get Full Res Images snippet finalJavaScript
$(window).load(function () {
    $('.entity-grid.entitylist').on("loaded", function () {
        getFullResImages();
    });
});
 
function getFullResImages() {
    $('table[role="grid"] tbody img[src*="Image/download.aspx"][src!="&Full=true"]').each(function () {
        var src = $(this).attr('src');
        $(this).attr('src', src + '&Full=true');
    });
}

The final step is to copy that JS and paste into the Custom JavaScript field on your List in the Portal Management app / Power Pages Management app.

Enjoy :)

Go deeper · Power Pages Mastery

This guide is one technique. The course is the method.

The course covers this in Level 1 · Foundations: “Forms, lists, validation, deep linking”, alongside “Data modelling for external users”. A structured programme distilled from dozens of real portal launches — from messy stakeholder requirements to successful go-live.

  • 6 weeks
  • 3 levels
  • Live training + video lessons
Where this fits
  1. Level 1Foundations
    • Forms, lists, validation, deep linking
    • Data modelling for external users
  2. Level 2Extending the platform
  3. Level 3Advanced customisation
Franco’s engaging teaching style made training a pivotal contribution to my professional growth. The walkthrough of a Power Pages site resembling Spotify left an indelible mark.
Bhargav Reddy — Solution Architect — TCS

Comments

No comments yet. Spotted a gotcha I missed? Say so below.

Leave a comment

Your email address won’t be published. Comments are moderated.

Consulting

Need a Power Pages build that editors love and brands survive?

I help teams design and build Power Pages sites with bespoke UX. Tell me about yours.

Search

Book a discovery call

30 minutes. Bring your trickiest Power Pages problem — I’ll tell you honestly whether I’m the right fit.