(Laravel)干预图像缓存无法在实时服务器上运行

时间:2015-04-26 09:26:37

标签: php image caching laravel-5 intervention

我使用Laravel 5构建了一个应用程序。干预/图像的图像缓存是在本地工作的。但是,在实时/真实服务器上,图片不显示。

这是错误代码:

Sorry, the page you are looking for could not be found.

1/1 NotFoundHttpException in Application.php line 901:

in Application.php line 901
at Application->abort('404', '', array()) in helpers.php line 21
at abort('404') in ImageCacheController.php line 118
at ImageCacheController->getImagePath('483a2f55-b0c5-366b-a00c-2c84e01f16c3.jpg') in ImageCacheController.php line 41
at ImageCacheController->getImage('blog', '483a2f55-b0c5-366b-a00c-2c84e01f16c3.jpg') in ImageCacheController.php line 27
at ImageCacheController->getResponse('blog', '483a2f55-b0c5-366b-a00c-2c84e01f16c3.jpg')
at call_user_func_array(array(object(ImageCacheController), 'getResponse'), array('template' => 'blog', 'filename' => '483a2f55-b0c5-366b-a00c-2c84e01f16c3.jpg')) in Controller.php line 246
at Controller->callAction('getResponse', array('template' => 'blog', 'filename' => '483a2f55-b0c5-366b-a00c-2c84e01f16c3.jpg')) in ControllerDispatcher.php line 162
at ControllerDispatcher->call(object(ImageCacheController), object(Route), 'getResponse') in ControllerDispatcher.php line 107
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108
at ControllerDispatcher->callWithinStack(object(ImageCacheController), object(Route), object(Request), 'getResponse') in ControllerDispatcher.php line 67
at ControllerDispatcher->dispatch(object(Route), object(Request), 'Intervention\Image\ImageCacheController', 'getResponse') in Route.php line 204
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 701
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Router.php line 703
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 670
at Router->dispatchToRoute(object(Request)) in Router.php line 628
at Router->dispatch(object(Request)) in Kernel.php line 214
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 115
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53

我在idhostinger上使用共享hostind(免费)来试用我的应用。请给我你的解决方案或经验来解决这个问题。

2 个答案:

答案 0 :(得分:0)

检查服务器映像驱动程序(在php_info gd或imagick中) 并检查laravel图像配置。 (配置/ image.php)

干预图像支持" GD图书馆"和#34; Imagick"处理图像 内部。您可以根据您的PHP选择其中一个 组态。默认情况下,PHP" GD Library"使用实现。 支持:" gd","想象"

答案 1 :(得分:0)

我找到了解决方案。

<强>配置/ image.php

public_path('images/article')

更改为

$_SERVER[DOCUMENT_ROOT] . '/images/article'