Try this, dynamic content with '/1/' will work perfectly
$str = "http://localhost/cms/uploads/files/1/images/1/hd-wallpaper-40.jpg";
//url as string
$pos = strpos($str,'1'); //position of first '1' in url
$len = strlen($str); //length of url string
$str1 = substr($str,$pos,($len-$pos)); //substring from '1' onwards
There are few drawbacks too. If the '1' occurres before , i mean url = "http://localhost/cms1/uploads/files/1/images, it will give wrong result.
If you use dynamic author id, instead of 1, save author id as a variable and insert in strpos(). The below one will be more accurate and you can use dynamic authorID too.
$str = "http://localhost/cms/uploads/files/1/images/1/hd-wallpaper-40.jpg";
//url as string
$authid = 1; //author id
$searchstring = '/'.$authid.'/'; // create a search string '/1/'
$pos = strpos($str,$searchstring); //position of first '/1/' in url
$len = strlen($str); //length of url string
$str1 = substr($str,$pos+1,($len-$pos)); //substring from '1' onwards