I'm learning about the Intervention Image package with Laravel 5.4. I've got an image stored in my public/images folder.
I installed Image according to the instructions on Intervention's page: added intervention to my composer.json file, ran composer update, updated my config/app file, and ran composer dump-autoload.
-
When directly accessed as an image (the printf statement in the code block below) the image displays.
-
Using the make method, I get a NotReadableException in AbstractDecoder.php.
Does anyone see if I'm doing something wrong in the code or may have missed a step in installation?
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Intervention\Image\Facades\Image;
class TestController extends Controller
{
public function imagetest()
{
printf('<img src="/images/j6.jpg">'); //correctly displays image on page
$img = Image::make("/images/j6.jpg")->resize(300, 200); //throws the error
return $img->response('jpg');
}
}
And here's the lead of the error block that's on the page after the "printf" image:
Whoops, looks like something went wrong.
1/1
NotReadableException in AbstractDecoder.php line 339:
Image source not readable
in AbstractDecoder.php line 339
at AbstractDecoder->init('/images/j6.jpg') in AbstractDriver.php line 64
at AbstractDriver->init('/images/j6.jpg') in ImageManager.php line 50
at ImageManager->make('/images/j6.jpg') in Facade.php line 221
at Facade::__callStatic('make', array('/images/j6.jpg')) in TestController.php line 14
at TestController->imagetest()
at call_user_func_array(array(object(TestController), 'imagetest'), array()) in Controller.php line 55
at Controller->callAction('imagetest', array()) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(TestController), 'imagetest') in Route.php line 203
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rg5vjo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire