Get an image url out of array

Support General Get an image url out of array

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #6221
    BLAQBLAQ
    Participant

    Hello!

    Sorry for that kind of newbie question.
    But how get I the output of an array?

    I've started with
    rwmb_meta('meta-box-id');

    If I put in the ID of e.g. an advance_image meta box. How do I get the URL of an image?

    #6222
    Anh TranAnh Tran
    Keymaster

    Hi,

    rwmb_meta( 'image_field_id' ) returns an array of image info. To get the URL of the image, simply use the code like this:

    $image_info = rwmb_meta( 'image_field_id', 'size=thumbnail' );
    echo $image_info['url']; // Thumbnail size URL
    echo $image_info['full_url']; // Full size URL
    #6223
    Truong GiangTruong Giang
    Participant

    Hi there,

    If you use above code, you will retrieve an array of image data, and you can get the image url from that array. Please read the docs here: https://metabox.io/docs/get-meta-value/#section-image

    #6226
    BLAQBLAQ
    Participant

    Thanks a lot! It was a great forrest, I didn't see the tree!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Get an image url out of array’ is closed to new replies.