Pictures on the display form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

21 Dec 2015

Hi, is there a way to show attachment on the form as pictures? For example: I have 1 or several pictures attached to the item and I want on them to be visible on the display form as a preview / thumbnails. There would be of course different pictures attached to different items.

Katy
Posts: 145
Joined: Wed Dec 02, 2015
Location: Canada

21 Dec 2015

Found this code and it works:

(function(){
var b=document.getElementById('idAttachmentsTable');
if(b){
var c=b.getElementsByTagName('A'),a,d;
for(var i=0,l=c.length;i<l;i++){
a=c;
if(!(new RegExp('\.jpg|\.jpeg|\.png|\.gif|\.bmp|\.tif|\.tiff','i').test(a.href)))continue;
d=document.createElement('img');
d.style.width='250px';
d.style.border='0';
d.src=a.href;
a.appendChild(document.createElement('br'));
a.appendChild(d)
}
}
})();



In case someone would need it :-)

User avatar
AlexStenAlexSten
Posts: 31
Joined: Fri Apr 07, 2017

23 Jan 2018

Hi Katy,
thank you for posting this code. Very helpful.
Do you know if it is possible to have also a preview of PDF files in the form?
thank you
ciao,
Ale Stendardo

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests