rwmb_meta image upload field

Support General rwmb_meta image upload field

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #36171
    Ole PoetterOle Poetter
    Participant

    Hi,

    I use rwmb_meta to get alle the values from a image upload field.
    I have max. 5 images in this field. Sometimes, I have to adress the images seperatly, fro example I want only output the third element of the array.

    I had expected that the array keys of the individual image elements would be numbered from 0 to 4 (because I have mx. 5 images in the field) so that i could address them directly: $image[1][url] for example gives me the url of the second image.

    But the in the first level of that array the key is the same number as the ID of the image.

    I'dont know the ID bevor output, so how can i adress single images of that array?

    Kind regards,
    Ole

    #36181
    Long NguyenLong Nguyen
    Moderator

    Hi Ole,

    The field image_upload saved the IDs of images in the database. So if you want to get an array with the indexed key like that, you can use the function get_post_meta(). For example:

    $value = get_post_meta( $post_id, 'image_upload' );

    It will return an array of image IDs and you can get image info by using the function wp_get_attachment_image().

    #36186
    Ole PoetterOle Poetter
    Participant

    Hi Long,

    Thank you very much, I got it!

    By the way...when I click here in the forum of my name to see my last postings, on this page the pagination doesn't work. I doesn't matter wich page number I click, I get redirected to the first page.

    Kind regards,
    Ole

    #36205
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Thanks for your feedback.

    I've escalated this issue to the development team to fix it.

    #36223
    Ole PoetterOle Poetter
    Participant

    Hi Long,

    now the link to the second page https://support.metabox.io/users/user_60f46491f04fe/page/2/ redirects to https://support.metabox.io/ 😉

    Kind regards,
    Ole

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