That’s the problem I am trying to describe to you..
In the media library the images are all in order, 396 is at the top, 001 at the bottom. Then if I go into the image gallery for the portfolio, the images are all out of order, with image 270 at the top. Then, on the public view of the portfolio, the images are in yet a different order, with the first image being 170.
I spent some time reordering the images, but then the portfolio cover image disappeared. When I put it back, the image gallery reordered itself in a different order again.
There must be a bug in your code somewhere. I can show you what I mean if you like? How do I upload images to this thread?