[英]Missing/broken image after migration for Cake PHP
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.我正面临这个问题,其中来自 app/media/tf/img/ 的图像已损坏,而来自其他路径的图像工作正常。 Below are stack trace from error.log
下面是来自 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.
此外,我确实在这里尝试了相同的解决方法,但仍然无法正常工作。很高兴有人能提供帮助,因为我是 CakePHP 的新手。
UPDATE更新
Just tried to change the path app/img, it is working.刚刚尝试更改路径 app/img,它正在工作。 It's kind of weird since media/transfer/img are in the same webroot.
这有点奇怪,因为 media/transfer/img 在同一个 webroot 中。
img--> tried direct path(app/img/..), working img--> 尝试直接路径(app/img/..),工作
media--> tried /transfer/img/.. path, not working媒体--> 试过 /transfer/img/.. 路径,不工作
manual--> tried direct path(app/manual/..), also not working手动-> 尝试直接路径(app/manual/..),也无法正常工作
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检查app.php中的
app.php
,这里我们分配文件夹
$this->Html->image();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.