compress first 10 images corrected if statement