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

psychosocial227's avatar

Laravel image broken after app was running okay

Hi my app was running preety well until today i realise image link is broken why working with notification and hoping to deploy anytime soon and a nighmare emerge. Here is how i set up my image algorithm. Am using intervention image package. As i said everything was working perfectly fine as first and i will be grateful if anyone can help with this nightmare.

This my store method

public function store(Request $request)
    {

        $this->validate($request,[
            'title' => 'required',
            'image' => 'required',
            'categories' => 'required',
            'body' => 'required',
        ]);

        $image = $request->file('image');
        $slug = str_slug($request->title);

        if(isset($image))
        {

        #  make unipue name for image
            $currentDate = Carbon::now()->toDateString();
            $imageName  = $slug.'-'.$currentDate.'-'.uniqid().'.'.$image->getClientOriginalExtension();

            if(!Storage::disk('public')->exists('post'))
            {

                Storage::disk('public')->makeDirectory('post');
            }

            $postImage = Image::make($image)->resize(1600,1066)->stream();
            Storage::disk('public')->put('post/'.$imageName,$postImage);

        } else {

            $imageName = "purple.png";
        }

        $post = new Post();
        $post->user_id = Auth::id();
        $post->title = $request->title;
        $post->slug = $slug;
        $post->image = $imageName;
        $post->body = $request->body;
             $post->save();
      
        return redirect()->route('admin.post.index');
    }

This my view and this how the image is called

{{ asset('Storage/post/'.$post->image) }}

php artisan storage:link have been utilized

this how my filesystem is set up

'default' => env('FILESYSTEM_DRIVER', 'local'),
 'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),

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

If am missing anything please let me know thanks in advance.

0 likes
8 replies
lostdreamer_nl's avatar

Please put all your code between

```

CODE GOES HERE  

```

So we can actually read it.

Also, {{ asset('Storage/post/'.$post->image) }} should probably be {{ asset('storage/post/'.$post->image) }} note the lowercase 's' in storage.

On windows this would work, but on any linux server it will fail as they are case sensitive. Try never to use any capitalization in URLs.

If that didnt fix it, please indent the code within the correct tags so we can have a look ;)

1 like
lostdreamer_nl's avatar

@psychosocial227

  • Is the image being uploaded (is it in the storage folder)? or do you get errors during upload?
  • Does the Post have it's 'image' attribute set after creating?
  • Can you access the image's URL ?
  • Is this only with newly uploaded images or also with old ones?
psychosocial227's avatar

@LOSTDREAMER_NL - The image is in the storage folder

Yes the image attribute is set

Image URl can be access

Even old image that work properly are affected

lostdreamer_nl's avatar

wait what......

  • The attribute is set
  • The link ( /storage/post/{ image.jpg } can be accessed

Then what is the problem ?

Is the URI on which you can access the image the same as what you get from `{{ asset('Storage/post/'.$post->image) }} ?

The lists you can make by adding - before your sentences ;)

Please or to participate in this conversation.