Page 1 of 1

Pictures on the display form

Posted: 21 Dec 2015
by Katy
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.

Re: Pictures on the display form

Posted: 21 Dec 2015
by Katy
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 :-)

Re: Pictures on the display form

Posted: 23 Jan 2018
by AlexStenAlexSten
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