(Laravel) 干预图像缓存在实时服务器上不起作用
(Laravel) Intervention image cache not working on live server
我使用 Laravel 5 构建了一个应用程序。 intervention/image 的图像缓存是在本地工作的。但是,在 live/real 服务器上,图片不显示。
错误代码如下:
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 上使用共享主机(免费)来试用我的应用程序。请给我你的解决方案或经验来解决这个问题。
检查服务器图像驱动程序(在php_info gd 或 imagick 中)
并检查 laravel 图像配置。 (config/image.php)
干预图像支持"GD Library"和"Imagick"处理图像
在内部。您可以根据自己的情况选择其中之一 PHP
配置。默认使用 PHP 的 "GD Library" 实现。
支持:"gd"、"imagick"
我找到了解决方案。
config/image.php
public_path('images/article')
改为
$_SERVER[DOCUMENT_ROOT] . '/images/article'
我使用 Laravel 5 构建了一个应用程序。 intervention/image 的图像缓存是在本地工作的。但是,在 live/real 服务器上,图片不显示。
错误代码如下:
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 上使用共享主机(免费)来试用我的应用程序。请给我你的解决方案或经验来解决这个问题。
检查服务器图像驱动程序(在php_info gd 或 imagick 中) 并检查 laravel 图像配置。 (config/image.php)
干预图像支持"GD Library"和"Imagick"处理图像 在内部。您可以根据自己的情况选择其中之一 PHP 配置。默认使用 PHP 的 "GD Library" 实现。 支持:"gd"、"imagick"
我找到了解决方案。
config/image.php
public_path('images/article')
改为
$_SERVER[DOCUMENT_ROOT] . '/images/article'