drupal 8 get image url from target_id code example
Example: 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();