Pictures on the display form

rss

Posted by Katy - Dec 21 ’15 at 09:06

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
    Member
    Member for: 5 years 2 months 28 days
    #1 by Katy Dec 21 ’15 at 09:45

    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[i];
    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 :-)

Displaying 1 to 1 of 1 messages