Custom Fields
Re-Envisioned
Support Meta Box Group Cant get image with php object

This topic contains 5 replies, has 2 voices, and was last updated by  Yuttapong Laksapto 2 months, 1 week ago.

  • Creator
    Topic
  • #16056
    Resolved
    Yuttapong Laksapto
    Participant

    my client server use php version low than 5.6
    how can i get image with not php object way

    thankyou

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #16091

    Anh Tran
    Keymaster

    Hi,

    What do you mean “not php object way”? Is there any relation with PHP 5.6?

    #16093

    Yuttapong Laksapto
    Participant

    sorry i not good with english

    my problem is i can’t use
    <“$image = RWMB_Image_Field::file_info( $image_id, [‘size’ => ‘thumbnail’] );”
    if use this code the page will show “http 500 internal server error”

    i guess the cause is php is less than 5.6 it not support object-orient right?

    sorry again for my poor english

    #16094

    Yuttapong Laksapto
    Participant

    this is my full code

    <?php
    $room_view_group = rwmb_meta( 'rk2019_project_room_preview' );
    if( ! empty( $room_view_group ) ) {
        $room_count = 0;
        foreach( $room_view_group as $room ) {
            $room_count++;
            $room_name = isset( $room['rk2019_room_peview_name'] ) ? $room['rk2019_room_peview_name'] : '';
            $room_img = isset( $room['rk2019_room_peview_img'] ) ? $room['rk2019_room_peview_img'] : array();
            $room_text = isset( $room['rk2019_room_peview_text'] ) ? $room['rk2019_room_peview_text'] : '';
            
            foreach( $room_img as $room_img_id ) {
                $room_show_img = RWMB_Image_Field::file_info( $room_img_id, ['size' => 'thumbnail'] );
            }
    ?>
    );">
        
            
                
                    
                
            </div>
        </div>
    </div>
    <?php
        }
    }
    ?>
    #16107

    Anh Tran
    Keymaster

    I see. That syntax is for PHP >= 5.4 which supports short array syntax. Please try:

    $room_show_img = RWMB_Image_Field::file_info( $room_img_id, array( 'size' => 'thumbnail' ) );
    

    It’s better to upgrade to PHP 7.2, the performance is twice better than PHP 5.

    #16114

    Yuttapong Laksapto
    Participant

    yeah it’s work!

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.