In CakePHP case it's not very easy because the controller file which usually generates an image by some action is not the only file loaded by PHP interpreter. But there is a function in PHP that can tell you what files have been included and therefore could influence the output. The function is get_included_files(). Here is an example of debug() output of function results:
app\controllers\users_controller.php (line 13)A pretty long list, but it's unlikely that core CakePHP files have extra line breaks inside, so we should only check the files that belong to the project and clean the extra characters out.
Array
(
[0] => Y:\home\my_project\www\index.php
[1] => Y:\home\cakes\latest\cake\bootstrap.php
[2] => Y:\home\cakes\latest\cake\basics.php
[3] => Y:\home\cakes\latest\cake\config\paths.php
[4] => Y:\home\cakes\latest\cake\libs\object.php
[5] => Y:\home\cakes\latest\cake\libs\inflector.php
[6] => Y:\home\cakes\latest\cake\libs\set.php
[7] => Y:\home\cakes\latest\cake\libs\configure.php
[8] => Y:\home\cakes\latest\cake\libs\file.php
[9] => Y:\home\cakes\latest\cake\libs\folder.php
[10] => Y:\home\cakes\latest\cake\libs\cache.php
[11] => Y:\home\my_project\cake_files\app\config\core.php
[12] => Y:\home\cakes\latest\cake\libs\debugger.php
[13] => Y:\home\cakes\latest\cake\libs\cake_log.php
[14] => Y:\home\cakes\latest\cake\libs\cache\file.php
[15] => Y:\home\my_project\cake_files\app\config\bootstrap.php
[16] => Y:\home\cakes\latest\cake\libs\string.php
[17] => Y:\home\cakes\latest\cake\libs\session.php
[18] => Y:\home\cakes\latest\cake\libs\security.php
[19] => Y:\home\cakes\latest\cake\dispatcher.php
[20] => Y:\home\cakes\latest\cake\libs\router.php
[21] => Y:\home\cakes\latest\cake\libs\controller\controller.php
[22] => Y:\home\cakes\latest\cake\libs\controller\component.php
[23] => Y:\home\cakes\latest\cake\libs\view\view.php
[24] => Y:\home\cakes\latest\cake\libs\view\helper.php
[25] => Y:\home\cakes\latest\cake\libs\overloadable.php
[26] => Y:\home\cakes\latest\cake\libs\overloadable_php5.php
[27] => Y:\home\cakes\latest\cake\libs\class_registry.php
[28] => Y:\home\my_project\cake_files\app\config\routes.php
[29] => Y:\home\my_project\cake_files\app\config\inflections.php
[30] => Y:\home\my_project\cake_files\app\app_controller.php
[31] => Y:\home\my_project\cake_files\app\controllers\users_controller.php
[32] => Y:\home\cakes\latest\cake\libs\controller\components\session.php
[33] => Y:\home\my_project\cake_files\app\controllers\components\helper_functions.php
[34] => Y:\home\my_project\cake_files\app\controllers\components\sd_auth.php
[35] => Y:\home\cakes\latest\cake\libs\controller\components\request_handler.php
)
P.S. This could probably be automated by a bash/php script.