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

AlessioLibbi's avatar

Thumbnail path error

Thats is how im trying to use the thumbnail and im getting this error "Source is not allowed. Given path "/storage/profile/Wr1R7o9gKf1R0mPtfhbEhP98RJezuKz0RfOVG0wS.jpg"" someone know i can solve this

img src="{{ Thumbnail::src('/storage/' . $user->picture)->crop(64, 64) }}" alt="picture" class="w-100 rounded-circle"

0 likes
8 replies
Snapey's avatar

/storage/ is not within your project

What is Thumbnail:: ?

1 like
AlessioLibbi's avatar

Hey @snapey so Thumbnail comes from this library -> rolandstarke/laravel-thumbnail

the storage was for building the path

testuser98's avatar

@AlessioLibbi I think you need to give you folder name other wise generate php artisan storage:link using create symbolic link and access Image from public folder.

1 like
testuser98's avatar

@AlessioLibbi Then give a proper path like a asset('/storage/folder_name/img_name') or using a public_path('/storage/folder_name/img_name') or storage_path('/storage/folder_name/img_name').

1 like
AlessioLibbi's avatar

@testuser98 before I started implementing thumbnails I used this -> img src="{{ asset('storage/' . $user->picture) }}" alt="picture" class="w-100 rounded-circle"

AlessioLibbi's avatar

iv reached this point

-> img src="{{Thumbnail::src(asset('storage/' . $user->picture) )->crop(64, 64) }}" alt="picture" class="w-100 rounded-circle"

->htmlspecialchars(): Argument #1 ($string) must be of type string, Rolandstarke\Thumbnail\Thumbnail given

AlessioLibbi's avatar
AlessioLibbi
OP
Best Answer
Level 1

ok iv solved the problem i was missing to use "url()" after "Thumbnail::src(asset('storage/' . $user->picture), 'public' )->crop(64, 64)" so i was returning not a string but a thumbnail object with that in it works

Please or to participate in this conversation.