Change determination extension associated files

Normally determine extension by finding first . approaching from right.
For associated files use length of media_file basename to
determine the extension (approach from left).