fix bug with jpeg filenames

using images with uppercase extension resulted in a crash