We can't be sure that the file extension will always be of length 3. This should be calculated from the imgPath itself.