A Cozmoslabs Product
Documentation / Custom Fields Creator / How to / Working with Images

Working with Images

For a Single Meta Box

To display the thumbnail size for a Image Upload Field Avatar in a Single Meta Box:

1
2
3
4
5
<?php 
global $post;
$image_object = get_cfc_field('my_meta_name', 'avatar', $post->ID );
?>
<img src="<?php echo $image_object['sizes']['thumbnail']; ?>" alt="<?php echo $image_object['alt']; ?>" title="<?php echo $image_object['title']; ?>" />

For a Repeater Meta box

Creating a Gallery from the Image Upload Field named Photo from a Repeater Meta Box in The Loop:

1
2
3
4
5
6
7
8
9
10
<div id="gallery">
<?php
foreach( get_cfc_meta( 'my_meta_name' ) as $key => $value ){ ?>
    <?php $photo_obj = get_cfc_field( 'my_meta_name','photo', false, $key );  ?>
    <div class="gallery-element">
        <img src="<?php echo $photo_obj['url']; ?>" height="<?php echo $photo_obj['height']; ?>" width="<?php echo $photo_obj['width']; ?>"/>
        <span class="img-caption"><?php echo $photo_obj['caption']; ?></span>
    </div>
<?php } ?>
</div>

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket