image and gallery performance improvement