1

I created a "Property" Custom Object and have Notes and Attachments in the layout. Is it possible to create a Visual Force page the will show a thumbnail images of the files attached? I ofcourse would like images only but if a PDF or other document is attached that ok as well even if it shows the icon. It will be a big plus if the Visual force page scrolls left or right.

Or is it better to just create a "Image" Custom Object and create a Master Detail relationship but still have a VisualForce page for the thumbnails <<<<

Here is what I am looking for....
enter image description here

Please understand i'm a noob and your help is highly appreciated.

3
  • I photoshopped that hahaha
    – Ninja King
    Mar 16, 2015 at 21:16
  • Both are possible. You'll need to learn html/visualforce ... but don't worry, it's fun! developer.salesforce.com/page/User_Interface Mar 16, 2015 at 21:33
  • thanks. im currently learning that but a code would be noice so I can reference whtat I'm doing. So far, i've reserach and nothing like this is showing.
    – Ninja King
    Mar 16, 2015 at 21:51

1 Answer 1

2

A VF page with the following code should work for you. Good Luck!

<apex:page standardController="Property__c" showHeader="false" sidebar="false">

<style type="text/css">
    * {
        margin:0;
        padding:0;
    }

    body {
        text-align:center;
    }

    #scroll {
        width:800px; /* adjust this size for width */
        height:225px;
        margin:0px auto;
        border:1px solid #000;
        overflow-x:auto;
        overflow-y:hidden;
        white-space:nowrap;
    }

    #scroll img
    {
        margin:5px 10px 0 10px;
    }

</style>

<div id="scroll">

    <apex:repeat value="{!Property__c.Attachments}" var="a">

        <apex:variable value="dummy" var="dummy" rendered="{!CONTAINS(a.Name, '.jpg') || CONTAINS(a.Name, '.gif') || CONTAINS(a.Name, '.png') || CONTAINS(a.Name, '.jpeg')}">

            <img src="/servlet/servlet.FileDownload?file={!a.Id}" title="{!a.Name}" style="max-height: 200px"/>

        </apex:variable>

    </apex:repeat>
</div>


</apex:page>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .