How to control the order of the images

Last post 04-29-2013, 12:04 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  04-28-2013, 7:22 PM 77321

    How to control the order of the images

    Images seem to be randomly displayed - is there any way to have the images shown in a particular order?  I've already named my images with an ascending ascii sort, but that doesn't seem to do it.

     

    bert

  •  04-29-2013, 12:04 PM 77325 in reply to 77321

    Re: How to control the order of the images

    Hi bertsirkin,

     

    The steps below shows you how to sort the image by your own logic in classic alyout.

     

    Please follow the steps below. Step 1- step 4 use to sort the order for the classic layout. Step 5 –step 7 use to sort the viwer. Step 2 and step 6 is the sort logic.


    1.      Open file “\CuteSoft_Client\Gallery\Layout\Classic\Code.js”


    2.      Add the code below to the top


    function BubbleSort(arr) {
        var temp;
        var exchange;
        for (var i = 0; i < arr.length; i++) {
            exchange = false;
            for (var j = arr.length - 2; j >= i; j--) {
                if ((arr[j + 1].Thumbnail) > (arr[j].Thumbnail)) {
                    temp = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                    exchange = true;
                }
            }
            if (!exchange) {
                break;
            }
        }
        return arr;
    }


    3.      Find section below


          for(var i=0;i<this._categories.length;i++)
          {
                photos=photos.concat(this._categories[i].Photos);
          }


    4.      Change it to


          for(var i=0;i<this._categories.length;i++)
          {
                photos=photos.concat(this._categories[i].Photos);
          }
          photos = BubbleSort(photos);


    5.      Open file “\CuteSoft_Client\Gallery\Viewer\LightBox\Code.js”


    6.      Add the code below to the top


    function BubbleSort(arr) {
        var temp;
        var exchange;
        for (var i = 0; i < arr.length; i++) {
            exchange = false;
            for (var j = arr.length - 2; j >= i; j--) {
                if ((arr[j + 1].Thumbnail) > (arr[j].Thumbnail)) {
                    temp = arr[j + 1];
                    arr[j + 1] = arr[j];
                    arr[j] = temp;
                    exchange = true;
                }
            }
            if (!exchange) {
                break;
            }
        }
        return arr;
    }
    7.      Find section below


          for(var i=0;i<cs.length;i++)
          {
                photos=photos.concat(cs[i].Photos);
          }
    8.      Change it to


          for(var i=0;i<cs.length;i++)
          {
                photos=photos.concat(cs[i].Photos);
          }
          photos = BubbleSort(photos);


     

    Regards,

     

    Ken 

View as RSS news feed in XML