> For the complete documentation index, see [llms.txt](https://drupal.bermaki.com/drupal-documentation-and-guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://drupal.bermaki.com/drupal-documentation-and-guides/backend/files-and-images.md).

# Files & Images

Example of how we work with files and images in Drupal 8/9.

### Get the url of an image

In this example, we get the url of an image that is added via a MEDIA field called "field\_image".

```php
use Drupal\file\Entity\File;

$mid = $node->field_image->target_id;
if (!empty($mid)) {
   // Crear enlace de la imagen
   $file = File::load($mid);
   $url = $file->getFileUri();
   $m_url = file_create_url($url);
}
```
