Update index.php

added gallery migration logic