0
0
APAndrea Pistarini
The $foto variable holds a reference to the entity associated with the field "field_foto" in the $ip object. The $foto_uri variable holds the URI of the file associated with the entity. The $foto_url variable holds the URL of the file.
Library: Drupal
$foto = $ip->get('field_foto')->referencedEntities();
$foto_uri = $foto->field_media_image->entity->getFileUri(); // It is for image media.
$foto_url = ImageStyle::load('mi_image_style')->buildUrl($foto_uri);