Cant get image with php object

Support MB Group Cant get image with php objectResolved

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16056
    Yuttapong LaksaptoYuttapong Laksapto
    Participant

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

    thankyou

    #16091
    Anh TranAnh Tran
    Keymaster

    Hi,

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

    #16093
    Yuttapong LaksaptoYuttapong 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 LaksaptoYuttapong 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 TranAnh 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 LaksaptoYuttapong Laksapto
    Participant

    yeah it's work!

    Thank you

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