Reserved field name image

I had a page that loaded very slowly. It must have taken 4-5 seconds for the server to respond.

After some debugging, I found out that it was due to the variable name image. I have an image on the page that has been given the name image in the blueprint.

Obviously image is a reserved function in Kirby:

After I changed the name, it runs smooth without problems and loads within milliseconds.

Are there really conflicts if I assign the name with image?

Yes, as per Fields | Kirby CMS

Field names may conflict with Kirby’s native methods. If you name a field image for example, it will conflict with the native $page->image() method.

I think if you absolutely had to use image as a field name, you would need to access it like this: $page->content()->get('image')

Brilliant, thank you

1 Like