image gallery logic to portfolio