Hi,
I have many image urls in my db, they vary in directorys...
/images/x.jpg /images/red/y.jpg /z.jpg
How can i replace all the urls with just the image name (x.jpg).
Also I need to then turn x.jpg into x_colour.jpg.
Thanks 🙂
One possibility (assume path is in variable $file):
$newFileName = preg_replace('/\.jpe?g$/i', "_color$0", basename($file));