Image extensions fix

New Change with less operations to get image extensions.