Images not retrieved through dynamic data and code?

Support MB Custom Table Images not retrieved through dynamic data and code?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #46850
    Roel PetraRoel Petra
    Participant

    Hi there,

    I'm trying to build a website where I can enter images under a repair. For this im using the Metabox "Image" field. However the image doesn't show on the frontend.

    I'm using a custom upload folder, I've also changed the root upload folder to /assets

    I'm using bricks builder, i've tried the image, image gallery and even custom code to get the images, however it doesn't get the images.

    I've contacted Bricks support but they told me to contact you guys since they also get the images using the rwmb_meta() function, which also didn't work.

    This is how metabox stores the image:
    a:1:{i:0;s:68:"https://moederbordreparatie.nl/assets/repairAttachments/IMG.jpg";}

    #46858
    PeterPeter
    Moderator

    Hello Roel,

    Thanks for your feedback.

    I recheck this case when using the image field, saving the image in a custom folder and field value in a custom table, the helper function rwmb_meta() doesn't return the correct value.
    I suggest you use an SQL query to get the field value instead of using the helper function. For example:

    global $wpdb;
    $post_id = get_the_ID();
    $images = $wpdb->get_col( "SELECT image FROM my_custom_table WHERE ID = $post_id" );
    
    foreach ( $images as $key => $image ) {
    	$image = maybe_unserialize( $image );
    	$image = array_pop( $image );
    	
    	echo '<img src="' . $image . '" />';
    }

    image is the field ID, my_custom_table is the custom table name.

    #46860
    Roel PetraRoel Petra
    Participant

    Hi Peter,

    Thank you for your reply, is it a bug that the helper function won't return the images?

    If so, could you report it? If not, i'd like to make this a feature request.

    Kind regards,
    Roel

    #46871
    Roel PetraRoel Petra
    Participant

    Hi Peter,

    I've tried the code you sent but it still does not retrieve the image.
    I've also tried with ChatGPT but it also doesn't seem to write any code that can solve it.

    Kind regards,
    Roel

    #46874
    Roel PetraRoel Petra
    Participant

    Small addition:
    Could it be that rwmb_meta doesn't support custom upload folders?

    #46882
    PeterPeter
    Moderator

    Hello,

    It is an issue with the custom table and custom upload folder. I've escalated this issue to the development team to check this. I will get back to you later.

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