So... now i found something useful... if a want to get last 3 chars from a string i can use negative values: substr($img_name,0,-3).
One more thing. what you do if you have .jpeg extention? there are 4 letters.