[eluser]sawatdee[/eluser]
I have some uploaded photos that I store in my /models/photos directory and my model returns an array of them based on some information. My model can not find them under /photos or ./photos. It can only see them under "./system/application/models/photos", which tells me that the approot is the working directory and it must be relative. If I try "/system/application/models/photos", then my model can not find them. But if I return "./system/application/models/photos/photoset/photo.jpg", my view does not display them. If I hard code "/system/application/models/photos/photoset/photo.jpg" (without the leading dot), my view can display them just fine. site_url () and BASEPATH will not work because I am not using an .htaccess file, so they both return approot/index.php. Even an absolute directory (/usr/local/apache2/....) did not work, and I really don't like my web directory showing up in my html files anyway. It took me 4 hours of trial and error to figure out why I could not see my images, and I still don't know what would be the most graceful way to handle this. Is there any way to know exactly what my model and view consider to be their root directory so that I can pass relative directories between them?
UPDATE:
So I did something like this in my model:
$viewDir = "/system/application/models/photos";
$modelDir = '.'.$viewDir;
I use $modelDir to find the files and I return $viewDir. However, I also have a custom library that I load in my controller and use in my view to get width and height info. So in my view, I have to pass '.'.$viewDir to my library.
It works, but it's clunky and awkward. There must be a better way.