Cake PHP迁移后图像丢失/损坏 [英] Missing/broken image after migration for Cake PHP
问题描述
我正在维护从另一个主机迁移的项目.
我正面临这个问题,其中来自app/media/tf/img/的图像损坏了,而来自其他路径的图像却正常工作.下面是来自error.log的堆栈跟踪
2020-12-04 16:44:47错误:[MissingControllerException]找不到控制器类TransferController.异常属性:array('class'=>'TransferController','插件'=>'媒体',)要求网址:/xy/media/tf/img/123.jpg堆栈跟踪:#0 E:\ www \ xy \ xy \ app \ webroot \ index.php(92):Dispatcher-> dispatch(Object(CakeRequest),Object(CakeResponse))#1 E:\ www \ xy \ xy \ index.php(41):require('E:\\ www \\ xy ...')#2 {main}
实际上,在旧服务器上,使用完全相同的源代码,一切正常.另外,我确实尝试过相同的解决方法
检查 app.php
中的 imageBaseUrl ,这里我们为该文件夹分配
$ this-> HTML-> image();
I'm maintaining to exist project which migrated from another host.
I'm facing this issue where the image from app/media/tf/img/ are broken whereas from other path are working fine. Below are stack trace from error.log
2020-12-04 16:44:47 Error: [MissingControllerException] Controller class TransferController could not be found.
Exception Attributes: array (
'class' => 'TransferController',
'plugin' => 'Media',
)
Request URL: /xy/media/tf/img/123.jpg
Stack Trace:
#0 E:\www\xy\xy\app\webroot\index.php(92): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#1 E:\www\xy\xy\index.php(41): require('E:\\www\\xy...')
#2 {main}
Actually, from old server everything's are working fine using the exact same source code. Also, I did tried for the same workaround here but still not working.Glad if someone could help as I'm new to CakePHP.
UPDATE
Just tried to change the path app/img , it is working. It's kind of weird since media/transfer/img are in the same webroot.
img--> tried direct path(app/img/..), working
media--> tried /transfer/img/.. path, not working
manual--> tried direct path(app/manual/..), also not working
But still I need to use the media path and if any explanation for this would be highly appreciated.
Check imageBaseUrl in app.php
, here we assign the folder for
$this->Html->image();
这篇关于Cake PHP迁移后图像丢失/损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!