Opps, I spoke too soon.
If I use str_replace, it is changing the name of my files - which is bad.
The files I need to access are in a directory 4 deep, e.g.
clients/name/01/thumbnails
basename() is only returning 'thumbnails',
str_replace will delete the letters 'cl' off any file name that starts with 'cl', and
ltrim is also deleting 'cl' from the filenames ( I assume because the path starts with the name 'clients').
I'm sure there is a simple way for me to get:
photo01.jpg
when the full path is:
clients/name/01/thumbnails/photo01.jpg
All the examples I have seen say to use str_replace. But this now seems dangerous in light of what I have found out (see above).
Any other ideas?
Thanks - Andrew