I'm a little bit confused ;) 

Description says that method is checking image extension, name of method if url has extension, and also you are checking is extension is jpg/jpeg.