Improved extension detection in widgets using images

Although the widgets may never have been intended to be given images in non-local paths, they might as well use code that correctly works in all cases.

Replaced find with find_last_of to properly detect the "." belonging to the extension of the image, and not accidentally grab a "." of  parenting out of a folder.