Get Image_advanced args using Metabox Group

Support MB Group Get Image_advanced args using Metabox Group

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6262
    uththamaguththamag
    Participant

    Hi,

    I have a question before purchasing Metabox Group addon.

    I want to create a separate gallery for the repeatable group.

    Is it possible to get the "Image_advanced" array of data in the image using the Metabox Group Field? Ex;

    array(
        'ID'   => 123,
        'name' => 'logo-150x80.png',
        'path' => '/var/www/wp-content/uploads/logo-150x80.png',
        'url' => 'http://example.com/wp-content/uploads/logo-150x80.png',
        'width' => 150,
        'height' => 80,
        'full_url' => 'http://example.com/wp-content/uploads/logo.png',
        'title' => 'Logo',
        'caption' => 'Logo caption',
        'description' => 'Used in the header',
        'alt' => 'Logo ALT text',
        'srcset' => 'large.jpg 1920w, medium.jpg 960w, small.jpg 480w' // List of responsive image src, added in 4.8.0
        'sizes' => array(), // List of image sizes. See http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata
        'image_meta' => array(), // List of image meta. See http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata
    )

    Regards
    UG

    #6269
    Anh TranAnh Tran
    Keymaster

    Hi,

    Yes, it's possible. This is the code on doing that:

    $group = get_post_meta( get_the_ID(), 'group_id', true );
    $images = isset( $group['gallery'] ) ? $group['gallery'] : array();
    foreach ( $images as $image ) {
        $image_info = RWMB_Image_Field::file_info( $image, array( 'size' => 'thumbnail' ) ); 
    }

    The RWMB_Image_Field::file_info helper function will get all the info of the image for you to use.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Get Image_advanced args using Metabox Group’ is closed to new replies.