Change single image size

Support General Change single image sizeResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31457
    Rebecca RobertsonRebecca Robertson
    Participant

    How do I add width and height to this bit of code:

    
    <?php 
    $image = rwmb_meta( 'state_featured_image', ['object_type' => 'term'], $state->term_id );
    echo '<img src='. $image['url'] .' />';
    ?>
    
    #31461
    Long NguyenLong Nguyen
    Moderator

    Hi Rebecca,

    You can add the size setting to the second parameter of the helper shortcode.

    $image = rwmb_meta( 'state_featured_image', ['object_type' => 'term', 'size' => 'large'], $state->term_id );

    Please read more here https://docs.metabox.io/fields/single-image/#template-usage

    #31462
    Rebecca RobertsonRebecca Robertson
    Participant

    Thank you!

    The documentation wasn't helping much, I tried putting the size everywhere I could think of. I finally ended up using the code from the adding images to categories.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.