Grouped page attachments

Martin Varecka asked on August 30, 2017 17:58

Hi,

I have Page Type with field Images (data type: Attachments, form control: Attachments) and this field containst more images.

How can I access to first image in transformation in repeater which create list of products?

On detail I use webpart "Page attachments" for display images, but I need display first image as thumbnail in list.

Thank you

Correct Answer

Brenden Kehren answered on August 30, 2017 18:31

Check out this post I had a few years back regarding what I believe you're looking for. This is valid for v8 and possibly v9 and v10 but haven't tested in those versions.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Peter Mogilnitski answered on August 30, 2017 18:56 (last edited on December 10, 2019 02:31)

you can do it with a simple macro as well: Just the first one:

{%<a href='/getattachment/" + CurrentDocument.AllAttachments.FirstItem.AttachmentGUID + "'>" + CurrentDocument.AllAttachments.FirstItem.AttachmentName + "</a> (" + 
    Round(CurrentDocument.AllAttachments.FirstItem.AttachmentSize/1024,0) + "KB)|(identity)GlobalAdministrator%}
0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 30, 2017 20:17

Peter, I don't believe what you're talking about with page attachments and what the OP wants which are grouped attachments are the same thing. Grouped attachments are not only stored with the page info but also stored with a group guid as the article I referenced shows.

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on August 30, 2017 21:58

Yeah Brenden, probably I misunderstood. I was talking about this kind of setup for a field: Image Text

0 votesVote for this answer Mark as a Correct answer

Martin Varecka answered on August 30, 2017 22:35

Thanks you both for answer. I think that Brenden's solution will work. I'll try it tomorrow - here is late night.

I used this manual, but there is no trasformation.

Below are some images of settings.

PageType

Image Text

Form. Multiple images of one product. Image Text

Part of transformation

  <div class="product-img-area flex-container vertical-center">
    <img src="<%# GetAttachmentUrl(Eval("PoolImage"), Eval("NodeAliasPath")) %>" alt="SwingPools">
  </div>

Result. Multiple product with (expected result) first image show. Image Text

0 votesVote for this answer Mark as a Correct answer

Martin Varecka answered on August 31, 2017 10:19

Thank you Brenden, it works.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.