Load node entity from external script with image URI I'm attempting to grab a node from a node ID in an external php script.
With Drupal 7 I used the bootstrap.inc but with Drupal 8 this are a bit different.

I've called Drupal with: 

define('DRUPAL_DIR', $webroot);

use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
use Drupal\file\Plugin\Field\FieldType;

$autoloader = require_once DRUPAL_DIR . '/autoload.php';
$request = Request::createFromGlobals();
$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
$kernel-&gt;boot();

require_once DRUPAL_DIR . '/core/includes/database.inc';
require_once DRUPAL_DIR . '/core/includes/schema.inc';


I'm then successfully loading the node with:

$node = \Drupal\node\Entity\Node::load($nid);


I'm able to grab values with:

$node-&gt;get('field_test_field')-&gt;value


but I'm unable to get a uri for images. If I try and get the target_id with:

$node-&gt;get('field_image_field')-&gt;value


I get an error and the following in the error log:

Error: Call to undefined function Drupal\\file\\Plugin\\Field\\FieldType\\file_default_scheme() in /var/www/vhosts/rootpath/webroot/core/modules/file/src/Plugin/Field/FieldType/FileItem.php on line 39


Any idea how I get get the image path? The returned node object includes:

[field_image_field] =&gt; Array
            (
                [x-default] =&gt; Array
                    (
                        [0] =&gt; Array
                            (
                                [target_id] =&gt; 44595
                                [alt] =&gt; 
                                [title] =&gt; 
                                [width] =&gt; 250
                                [height] =&gt; 89
                            )

                    )

            )


Not sure what I missing, perhaps I need to include a namespace or something?
Thanks in advance!
you can try:

$image_uri  = $node-&gt;field_image_field-&gt;entity-&gt;getFileUri();

echo $image_uri;

$image_url= file_create_url($image_uri);

echo $image_url;


in the variable "$ image_uri" contains the uri of the image.

in the variable "$ image_url" contains the complete url of the image.

Note: please, change field_image_field for your machine name field