Updated to only do stuff if there's actually any image files.