If or statement

Hi,

I have two image fields that I want to hide if both are not set in the panel. Is there a way to make this work:

if ($page->image1()->isNotEmpty()): or ($page->image2()->isNotEmpty()):

So that I can hide the section if both are empty, but show if one is not empty?

Have you tried:

if ($page->image1()->isNotEmpty() or $page->image2()->isNotEmpty()):

?

But actually you should always check if the images actually also exist:

if (($img1 = $page->image1()->toFile()) or ($img2 = $page->image2()->toFile())):

Thanks! This solved it:) I feel stupid for not seeing the mistake…

Also the suggestion for checking if the image actually exist is a really nice one!