Sequential file numbering...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cjl

    Sequential file numbering...

    Hey all:

    Slightly off topic...

    If I have a series of images that I want to convert to an animated gif
    using the command line tool 'convert' from imagemagick, they cannot be
    named:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11


    Because this is seen as:

    1
    10
    11
    2
    3
    4
    5
    6
    7
    8
    9

    So I am trying to write a PHP script that will sequentially convert and
    number a series of images, and I won't know ahead of time how many will
    be in a given sequence. This files are originally randomly numbered,
    but the sequence information can be extracted, and their order
    determined. I then want to rename them, and I'm thinking I should use:

    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    11

    This works, and I guess I'll just need to tally the number of images,
    and figure out if the 'lefthand' zeroes should be taken to the hundreds
    and thousands place.

    Anyone else know a simpler way around this problem?

    -cjl

  • Chung Leong

    #2
    Re: Sequential file numbering...

    "cjl" <cjlesh@gmail.c om> wrote in message
    news:1111467630 .496363.238210@ l41g2000cwc.goo glegroups.com.. .[color=blue]
    > Hey all:
    >
    > Slightly off topic...
    >
    > If I have a series of images that I want to convert to an animated gif
    > using the command line tool 'convert' from imagemagick, they cannot be
    > named:
    >
    > 1
    > 2
    > 3
    > 4
    > 5
    > 6
    > 7
    > 8
    > 9
    > 10
    > 11
    >
    >
    > Because this is seen as:
    >
    > 1
    > 10
    > 11
    > 2
    > 3
    > 4
    > 5
    > 6
    > 7
    > 8
    > 9
    >
    > So I am trying to write a PHP script that will sequentially convert and
    > number a series of images, and I won't know ahead of time how many will
    > be in a given sequence. This files are originally randomly numbered,
    > but the sequence information can be extracted, and their order
    > determined. I then want to rename them, and I'm thinking I should use:
    >
    > 01
    > 02
    > 03
    > 04
    > 05
    > 06
    > 07
    > 08
    > 09
    > 10
    > 11
    >
    > This works, and I guess I'll just need to tally the number of images,
    > and figure out if the 'lefthand' zeroes should be taken to the hundreds
    > and thousands place.
    >
    > Anyone else know a simpler way around this problem?
    >
    > -cjl
    >[/color]

    Use natcasesort() to sort the list.



    Comment

    Working...