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:

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

For a Repeater Meta box

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

<div id="gallery">
    <?php 
    foreach( get_cfc_meta( 'my_meta_name' ) as $key => $value ){ 
    $photo_obj = get_cfc_field( 'my_meta_name','photo', false, $key ); 
    ?>
    <div class="gallery-element">
        <img src="<?php echo $photo_obj['url']; ?>" width="<?php echo $photo_obj['width']; ?>" height="<?php echo $photo_obj['height']; ?>"><?php echo $photo_obj['caption']; ?>
    </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