Custom Fields
Re-Envisioned
Support MB REST API How to show image url with folder in all sizes from Rest API

  • Creator
    Topic
  • #16391
    PTiCA
    Participant

    I use the rest api plugin and metabox type “image_advanced”. Everything works fine, I just need to display URL images in all sizes with the complete url “/folder/image.jpg”.

    How do I do this?

    Thanks for advice

    rest api sizes

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #16412
    Anh Tran
    Keymaster

    Hi,

    You should transform the data from the REST response. Here is the example:

    $data = your_function_to_get_data_from_REST();
    $file = $data['file'];
    $folder = str_replace( basename( $file ), '', $file );
    $sizes = $data['sizes'];
    foreach ( $sizes as &$size ) {
        $size['file'] = $folder . $size['file'];
    }
    var_dump( $sizes ); // Now you have folder in your URL
    #17460
    PTiCA
    Participant

    Thanks for the report but I don’t know how to use this example.
    I am not a PHP programmer and I need an example that I just put into function.php and rest api will return complete image addresses.

    Thanx

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