drupal 8 uri with target_id code example
Example 1: drupal 8 get file url from target id
use Drupal\media\Entity\Media;
use Drupal\file\Entity\File;
$media = Media::load($mid);
$fid = $media->field_media_image->target_id;
$file = File::load($fid);
$url = $file->url();
Example 2: drupal 8 get media image uri
$image_url = $media->field_media_image->entity->getFileUri();
file_create_url($image_url);