Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

birdietorerik's avatar

Using storage to store images

Hi!

Cant get this to work, dosent find the image ??

                    <div class="card-body">
                        <div class="row">
                            <div class="col-md-12">
                                <img
                                    class="image rounded-circle"
                                    :src="'../storage/images/user.png'"
                                    alt="profile_image"
                                    style="
                                        width: 200px;
                                        height: 200px;
                                        padding: 10px;
                                        margin: 0px;
                                    "
                                />
                            </div>
                        </div>
                    </div>

Line -> :src="'../storage/images/user.png'"

Gives me 404 error

0 likes
36 replies
tykus's avatar

Did you php artisan storage:link?

Then:

 <img
    class="image rounded-circle"
    src="{{ asset('storage/images/user.png') }}"
birdietorerik's avatar

@tykus Hi!

Yes have run -> php artisan storage:link

Tryed your code, get error:

src="{{ asset('storage/images/user.png') }}": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <div id="{{ val }}">, use <div :id="val">.
tykus's avatar

@birdietorerik so, this is a Vue component; you might have mentioned that earlier or posted in the correct forum?

Are you passing data as a prop; or are you actually hard-coding the image path?

tykus's avatar

@birdietorerik in that case, use the absolute path

 <img
    class="image rounded-circle"
    src="/storage/images/user.png"
birdietorerik's avatar

@tykus Hi!

Gives me 404 error

Request URL: http://portal.test:8000/storage/images/user.png
tykus's avatar

@birdietorerik where is the image actually stored? And what links are created by the storage:link command - check your config/filesystems.php config file for the links key?

birdietorerik's avatar

@tykus Hi!

Filesystem.php

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 'local'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Symbolic Links
    |--------------------------------------------------------------------------
    |
    | Here you may configure the symbolic links that will be created when the
    | `storage:link` Artisan command is executed. The array keys should be
    | the locations of the links and the values should be their targets.
    |
    */

    'links' => [
        public_path('storage') => storage_path('app/public'),
    ],

];
tykus's avatar

@birdietorerik do you actually have a user.png image in the {PROJECT_ROOT}/storage/app/public/images directory?

birdietorerik's avatar

@Sinnbeck images was missing ? I created this folder And copy my user.png file from storage/images Now i get 200 status, but image not showing ????

tykus's avatar

@birdietorerik you shouldn’t create the folder, it should be a symlink to the directory in storage

birdietorerik's avatar

Hi!

I get this in my console -> network

http://portal.test:8000/admin/storage/images/user.png
Request Method: GET
Status Code: 200 OK
Remote Address: 127.0.0.1:8000
Referrer Policy: strict-origin-when-cross-origin
birdietorerik's avatar

@Sinnbeck Hi!

In filesystems.php i have now:

'links' => [
        public_path('storage') => storage_path('app/public'),
        public_path('admin/storage') => storage_path('app/public'),
    ],

Is this the right way to do this ??

And try this:

 php artisan admin/storage:link

But gives me error:

 There are no commands defined in the "admin/storage" namespace.
1 like
birdietorerik's avatar

@tykus Hi!

In filesystems:

'links' => [
        public_path('admin/storage') => storage_path('app/public'),
    ],

Then when i run -> php artisan storage:link

Get this error:

 ErrorException 

  symlink(): No such file or directory

  at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:332
    328▕      */
    329▕     public function link($target, $link)
    330▕     {
    331▕         if (! windows_os()) {
  ➜ 332▕             return symlink($target, $link);
    333▕         }
    334▕ 
    335▕         $mode = $this->isDirectory($target) ? 'J' : 'H';
    336▕ 

      +15 vendor frames 
  16  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

birdietorerik's avatar

@tykus Hi! How do i do this ???

You say -> change the links config to include admin in the path Where ???

birdietorerik's avatar

Hi!

Have now change my URL from

Portal.test:8000/admin/… To

Portal.test:8000/…

But image is still not shown ?????

Please or to participate in this conversation.