Trimming and Replacing Text to Create New String
Posted: Sun Oct 23, 2005 10:13 pm
I have tried to use the following unsuccessfully:
trim()
preg_replace()
strstr()
I need to take a file location in my database similar to the following:
C:\mysite\Europe\Spain\Barcelona\Misc\Barcelona.jpg
and convert it to the following:
Thumbnails/mysite/Europe/Spain/Barcelona/Misc/Barcelona.jpg
It seems I would use trim() to trim the C:\ and then preg_replace() to convert the backslashes to forward slashes
Then add the Thumbnails string using .
Am I in the ballpark? I know it is very simple, but I just can not get it right.
Any insight would be appreciated
trim()
preg_replace()
strstr()
I need to take a file location in my database similar to the following:
C:\mysite\Europe\Spain\Barcelona\Misc\Barcelona.jpg
and convert it to the following:
Thumbnails/mysite/Europe/Spain/Barcelona/Misc/Barcelona.jpg
It seems I would use trim() to trim the C:\ and then preg_replace() to convert the backslashes to forward slashes
Then add the Thumbnails string using .
Am I in the ballpark? I know it is very simple, but I just can not get it right.
Any insight would be appreciated