How to query entries by field values
There is a related to parameter you can use



Entry::find()
  -&gt;section($section)
  -&gt;relatedTo(['targetElement' =&gt; $image-&gt;id, 'field' =&gt; 'galleryImages')
  -&gt;all();