Control the size of a Photo URL Sharepoint field

Hiya @mnikitina

I hope you can help us, we have a url field but we want to control the size of it. There doesn't seem to be a way to do this.

We can control it on a Edit and New Form by using the image control that is updated with the url of in the sharepoint field, but this doesn't work with the display form.

So we need either:

  1. A way to grab the field url and update the image (we have tried the usual way of pnp, but it doesn't work as we can't get the value from the lookup that updates the photo)
  2. A way to control the size (weight and height) of the Url photo type of sharepoint field in Forms.

Thanking you in advance!

Hiya @mnikitina

I have figured it out! Just adding this for anyone else who might need it :slight_smile:

You have to save the URL of the image to a hidden field and then you can call that field on the page load and you can see the image dimensions as normal:

fd.spRendered(function() {
//Always hide stuff
$('.AlwaysHide').hide();

//Update Image on load
fd.control('Image1').source = fd.field('Item_x0020_Photo').value.url;

});

Thankfully this works in the Display form too!

2 Likes