Answers for "drupal src medi by id"

1

drupal 8 get media image uri

$image_url = $media->field_media_image->entity->getFileUri();
file_create_url($image_url);
Posted by: Guest on October-01-2020
0

drupal 8 get file url from target id

use DrupalmediaEntityMedia;
use DrupalfileEntityFile;

$media = Media::load($mid);
$fid = $media->field_media_image->target_id;
$file = File::load($fid);

$url = $file->url();
Posted by: Guest on November-16-2020

Browse Popular Code Answers by Language