Get the UUID from multiple images?

Hey, i try to get all the uuids from my blueprints “image” and i dont know how. I want to have it in a string like:

‘file://1rfksepqneakth4c,file://2rfksepqneakth4c,file://3rfksepqneakth4c‘ (for example)

I tried:

$i = $page→image()→toFiles()

$arr =

foreach ($i as $img) {

$arr = $i→uuid()→toString()

}

but it doesnt work like this.

This is the Blueprints Image:

          image:

            label: Bild

            type: files

            multiple: true

            max: 3

            layout: cards

foreach ($i as $img) { - you will need to then also use $img not $I inside your loop.

Yea sorry, i did it like that.

    \# images

    $uuids = $page->image()->toFiles();



    foreach ($uuids as $uuid) {

        file_put_contents(\__DIR_\_ . '/../sync-log.txt', $uuid->uuid()->toSrting(), FILE_APPEND);

    }

Here it says: Call to a member function uuid() on null

With this i get all the UUIDS:

    $content = $page->content()->image()->toFiles();

    $uuids = \[\];



    foreach ($content as $uuid) {

        $uuids\[\] = $uuid->uuid();

    }



    $uuids = implode(",", $uuids);
1 Like

Didn’t catch that, sorry! Yes indeed $page->image() is a reserved page method. So if you use image as field name you have to take this detour to get to your field object.