Remove plugin info. It is standardized.
Fix variable name.
Regexp for extension was wrong

It did not check for the whole extension when replacing with server
provided extension. In addition it does now add the new extension when
there is not extension at all.
debug message.
Only set new extension for images
only remove php and html extension.