Photo view for table on Attachments object?

  • 2
  • Question
  • Updated 3 years ago
  • Answered
I have a bunch of image files attached to a single record, and I want to display them together. Anyone know of a way to do this? Table with photo view?

The problem I'm running into with the later is that it wants only one image per record. I have only a single record, and multiple images.

Perhaps I can use a field editor on the attachments model? Just thought of that while typing...
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 2
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
You probably won't use the photo view.  You will probably include the image URL in a template somewhere in your page.  

If the images are in the attachments object you can use syntaxt that looks like this: 

<img class="nx-attachmentimage-image" src="/servlet/servlet.FileDownload?file={{{AttachmentID}}}" style="max-width: 100%;">

You could create a child relationship of attachment images and then show the multiple images in a table cell. 
Or you could build a model focussed just on the attachment object (with a condition that links to a parent record) and use a field editor to iterate over the attements and show them on the page. 

Hopefully you can make it work. 
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Rob,

That's perfect. Thanks!
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Can someone point me to the thread which explains how to use CSS to get field editors to line up next to each other in rows?

Is it something like {
display: block;
float: left;
}

?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Photo of Jack Sanford

Jack Sanford, Champion

  • 8,322 Points 5k badge 2x thumb
Oh my! This is so amazing! Thanks for asking and answering this.

A word to any other newbies trying this, DO NOT INCLUDE Body as one of your attachment fields, results in " Visualforce Error: Apex heap size too large: 8506666 "