frontpage & output picture, php error

Support MB Builder frontpage & output picture, php errorResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #22605
    jw_blnjw_bln
    Participant

    I am using EXACT the method described in your own documentation to show a single image:

    <?php
        $images = rwmb_meta( 'xximagefieldxx', array( 'limit' => 1 ) );
        $image = reset( $images );?>
    <img src="<?php echo $image['url'];?>" width="xx" height="xx>

    but getting a PHP error:
    WARNING: reset() expects parameter 1 to be array, string given in var/www/xxx/ eval()'dcode on line 3

    So what's wrong? Documentation?

    It's worth mentioning that currently only one picture is stored in the field...
    Seems reset( $images ) refers to the same Image ID (the only existing one), maybe this is the error.
    The picture itself is printed out to html.

    Any advice?

    #22608
    Long NguyenLong Nguyen
    Moderator

    Hi,

    The code sample code is working well on my local site. Please ensure that the field ID is correct and the code is added to the post's template.

    You can also share the code that creates the field image. I will take a closer look.

    #22673
    jw_blnjw_bln
    Participant

    Sorry for the late reply.
    I need to mention again, that
    a) The picture itself is shown on the frontend, only in oxygen page builder (backend) it shows this behavior
    b) I am using the graphical builder, so all is automatically added
    c) There is only one picture existing, but reset() is an array function??
    d) Fields are existing, otherwise the picture would not have been visible

    I will check with the Oxypagebuilder support too.

    #23390
    Long NguyenLong Nguyen
    Moderator

    Related topic https://support.metabox.io/topic/https-url-of-single-image-original-size/.

    Mark as Resolved.

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