Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Re: [PHP] File ordering

    > I am doing a 'readdir' on a subdirectory. I did my file naming counting on
    > it ordering based on numbering... But when I do the readdir it isn't doing
    > it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
    > the month of Feb in 2003. This gave me automatic sorting. So I thought. But
    > it doesn't seem to be doing it. The server is a linux server
    > ((IStop/Doncaster consulting) and I don't see why the ordering is screwing
    > up. I checked the create dates and that isn't the ordering choosen (I have
    > pictures from July showing up between pictures from March).
    >
    > Thoughts, suggestions?
    >
    > Katherine
    >
    > This is the clip of code(srcdir being passed in):
    >
    > $imgdir = "$srcdir/images";
    > $txtdir = "$srcdir/txt";
    > $imgdh = opendir($imgdir);
    > $txtdh = opendir($txtdir);
    >
    > while($file = readdir($imgdh)) {
    > if(substr($file,-3)=="jpg") {
    > $imgFiles[] = $file;
    > $textFileName = substr($file,0,-3)."txt";
    > $textFiles[] = $textFileName;
    > }
    > }
    Just sort the $imgFiles array.

    --
    Lowell Allen

    Lowell Allen Guest

  2. Similar Questions and Discussions

    1. Grouping and ordering
      The manual says "MySQL extends the use of GROUP BY so that you can use non-aggregated columns or calculations in the SELECT list that do not appear...
    2. Help Ordering Records
      I have a database with two fields: ID and SVCS. SVCS contains a comma delimited list. So records on the dabase might look like this: ID - SVCS 1...
    3. table ordering
      Hi, Hope someone may be able to help me. I have created a dropdown style menu in Fireworks, and a movie in Flash, and am putting it all together...
    4. Ordering by date ???
      I have created a DB in Access 2000. The Date Field (clientdate) is currently a MEMO field. The date is being entered as: 10 June 2004 21...
    5. Ordering of recordsets
      Create some links (or a drop-down <select> list) that the user can click on to select the way they want the collection ordered. Dynamically build...
  3. #2

    Default Re: [PHP] File ordering

    * Thus wrote Katherine Barry (katherine@manaiakoru.com):
    > I am doing a 'readdir' on a subdirectory. I did my file naming counting on
    > it ordering based on numbering... But when I do the readdir it isn't doing
    > it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
    > the month of Feb in 2003. This gave me automatic sorting. So I thought. But
    hmm.. this wont sort properly:
    002_2003_66.jpg
    002_2004_66.jpg
    003_2003_66.jpg

    Use YEAR_MONTH_NUMBER.jpg

    also,
    002_2003_123.jpg
    002_2003_66.jpg

    Isn't entirely what you want.


    Curt
    --
    "I used to think I was indecisive, but now I'm not so sure."
    Curt Zirzow Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139