Support

Account

Home Forums Feature Requests Image: Array for each size

Unread

Image: Array for each size

  • Hello,

    If i return an image with get_field(), the sizes are in an array and i musst usw a “hack” to get url, height & width.

    Is it possible to return each size in an own array?

    Now:

    ["sizes"]=>
          array(18) {
            ["thumbnail"]=>
            string(71) "https://domain.tld/path/image-150x32.png"
            ["thumbnail-width"]=>
            int(150)
            ["thumbnail-height"]=>
            int(32)
            ["medium"]=>
            string(71) "https://domain.tld/path/image-300x64.png"
            ["medium-width"]=>
            int(300)
            ["medium-height"]=>
            int(64)
          }

    TO:

    ["sizes"]=>
          array(18) {
            ["thumbnail"]=> array(xx) {
                 ["src"] => string(71) "https://domain.tld/path/image-150x32.png"
                 ["width"]=>int(150)
                 ["height"]=>int(32)
            }
            ["medium"]=>array(xx) {
                 ["src"] => string(71) "https://domain.tld/path/image-300x64.png"
                 ["width"]=> int(300)
                 ["height"]=> int(64)
          }

    It would be easier to use in php and twig (i use timber on my pages)

    Thx for your answer!

    Greetings
    Kati

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.