Missing/broken image after migration for Cake PHP

半世苍凉 提交于 2020-12-30 10:44:41

问题


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.


回答1:


Check imageBaseUrl in app.php , here we assign the folder for

$this->Html->image();


来源:https://stackoverflow.com/questions/65140671/missing-broken-image-after-migration-for-cake-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!