<div class="span1"><?php echo $attachments->image('thumbnail'); ?> </div> <div class="span11"> <a target="_blank" href="<?php echo $attachments->url(); ?> " title="Download"><i class="icon-download-alt"></i> <?php echo $attachments->field('title'); ?> / <?php echo $attachments->filesize(); ?> (<?php echo $attachments->subtype(); ?> )</a> <?php if ($attachments->field('caption') != "") { ?> <p><?php echo $attachments->field('caption'); ?> </p> <?php } ?> </div> </div> <?php
function get_attachments_array($name, $srcSize = 'full') { $return = array(); $attachments = new Attachments($name); if ($attachments->exist()) { $i = 0; while ($attachments->get()) { $return[$i]['id'] = $attachments->id(); $return[$i]['type'] = $attachments->type(); $return[$i]['subtype'] = $attachments->subtype(); $return[$i]['url'] = $attachments->url(); $return[$i]['thumbnail'] = $attachments->image('thumbnail'); $return[$i]['srcfull'] = $attachments->src('full'); $return[$i]['src'] = $attachments->src($srcSize); $return[$i]['filesize'] = $attachments->filesize(); $return[$i]['title'] = $attachments->field('title'); $return[$i]['caption'] = $attachments->field('caption'); $i++; } } return $return; }