What's the output of public_path($path)? Why aren't you just using $path?
Also, instead of $file = substr(strrchr($path, '/'), 1); you can use basename:
$file = basename($path);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have saved an image and wish to make a thumbnail. Using the 5.3 I have used: $path = $request->file('image')->store('public/users'); Now the idea is to make a thumbnail. I have the following code: $file = substr(strrchr($path, '/'), 1); $tpath = 'public/users/thumbs/'.$file; $image = \Image::make(public_path($path))->resize(100, 100); but I get the following error message: NotReadableException in AbstractDecoder.php line 302: Image source not readable The uploaded file is readable as I have writtena view which displays it OK. Any ideas please?
Well there was a better solution as I simply could not get this to work. This way there is no generation of thumbnail as jQuery does it on the fly (http://www.garralab.com/nailthumb-examples.php)
simply by adding two files to the master layout (assuming jQuery is loaded):
<link rel="stylesheet" src="{{ asset('css\jquerynailthumb.1.1.css') }}" type="text/css" />
<script type="text/javascript" src="{{ asset('js/jquery.nailthumb.1.1.min.js') }}"></script>
and defining a bit of css:
.square-thumb-60 {
width: 60px;
height: 60px;
}
It is just then a case of jQuery's document ready adding:
$('.nailthumb-container').nailthumb();
and wrapping the required photo in a div:
@if ($user->image <> '')
<div class="nailthumb-container square-thumb-60">
<img src="{{Storage::url( $user->image )}} "/>
</div>
@endif
Works perfectly and there are other options for the JavaScript.
Highly recommended!
Please or to participate in this conversation.