Home Forums Add-ons Options Page Get the value (image url) of custom size in a repeater


Get the value (image url) of custom size in a repeater

  • Hello I’m trying to get the value of the image url with the custom size but it is not working.

    I tried with the example you gave in the images documentation page but i think I’m doing something wrong as i changed get_field to get_sub_field as i have the image in a Repeater..

    There is no problem with cropping the image in the admin with Options add-on page but just can’t get the values to display the cropped image.

    Thanks`<!–Featured Image Slider–>
    <?php if(get_field('orbit_slider', 'option')): ?>
    <?php while(has_sub_field('orbit_slider', 'option')): ?>

    <?php $attachment_id = get_sub_field('orbit_image');
    $size = “customsize”;

    $image = wp_get_attachment_image_src( $attachment_id, $size );
    // url = $image[0];
    // width = $image[1];
    // height = $image[2];
    <img src=”<?php echo $image[0]; ?>” />

    <?php endwhile; ?>
    <?php endif; ?>
    <!– End Featured Image Slider–> `

  • okay it took me sometime but figured it out till the end

    I had to add the ‘option’ when calling for the image field

    <?php $attachment_id = get_sub_field(‘orbit_image’, ‘option’);


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get the value (image url) of custom size in a repeater’ is closed to new replies.