I want this php code....

Discussion in 'PHP' started by bluemouse2, May 14, 2006.

  1. #1
    Hi!
    I want this php code:

    let's say I have 31 images inside a directory named 01.jpg, 02.jpg ....31.jpg
    I want to rename them automatically via a script to something like red.jpg, white.jpg, blue.jpg, etc.

    example:

    01.jpg ----> red.jpg
    02.jpg ----> white.jpg

    .......................

    31.jpg -----> blue.jpg

    The list of colors is defined by me (red.jpg, white.jpg ... blue.jpg...)
    So basically I want to rename the pics to a pre-defined list of names.

    In exchange I will offer you a free listing on my PR5 directory: http://www.greenlettuce.info which has PR4 pages

    Thank you.
     
    bluemouse2, May 14, 2006 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,826
    Likes Received:
    4,541
    Best Answers:
    123
    Trophy Points:
    665
    #2
    If this is a one off it'll be quicker to use FTP, press f2 and type in the name
     
    sarahk, May 14, 2006 IP
  3. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #3
    I don't want to use rename via FTP because it takes time to rename 31 files and their names are not so easy (red, blue is just an example)
     
    bluemouse2, May 14, 2006 IP
  4. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #4
    any help?....
     
    bluemouse2, May 15, 2006 IP
  5. Big 'G'

    Big 'G' Member

    Messages:
    89
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    48
    #5
    load the files into an array and use a loop to change the filename
     
    Big 'G', May 16, 2006 IP
  6. frisby

    frisby Well-Known Member

    Messages:
    1,378
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    140
    #6
    And how do you know which images are red, yellow, bue... must define this i think. :/
     
    frisby, May 16, 2006 IP
  7. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #7
    it doesn't matter what order... color is just an example

    if anyone can write me the php code I'd appreciate - and you get the listing on my PR5 directory of course ;)
     
    bluemouse2, May 16, 2006 IP
  8. -Abhishek-

    -Abhishek- Regaining my Momentum!

    Messages:
    2,109
    Likes Received:
    302
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Please provide an indepth detail of the script required...
    Let's say you have 3 images on your server ....
    Apple
    Mango
    Grapes ...

    Now you want them renamed as,
    Guava
    Banana
    Melon

    So how would you define the set off renaming ??
    Would you want the script to be like ??
    Rename >>
    1. [Text Box] to [Text Box]
    2. [Text Box] to [Text Box]
    3. [Text Box] to [Text Box]
    (Submit Button)

    So you enter like
    1. [Apple] to [Banana]
    2. [Mango] to [Guava]
    3. [Grapes] to [Melon]

    Press Submit ... and they are renamed ??
    Something like this ... or maybe a drop down menu containing the names ??
    Please elaborate ...
    Abhishek
     
    -Abhishek-, May 16, 2006 IP
  9. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #9
    YES, a form would be great - but the difference is that all the fields are already completed - I just have to push the "rename" button

    example:

    01.jpg >>>>>>> mango.jpg
    02.jpg >>>>>>> apple.jpg
    ....................................

    31.jpg >>>>>>> honey.jpg

    If you can help me with the code for 2 fields it's ok - I will figure out the rest by myself.
    Thanks.
     
    bluemouse2, May 16, 2006 IP
  10. frisby

    frisby Well-Known Member

    Messages:
    1,378
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    140
    #10
    Don't you not understand? mango, apple, where will you set this damn, will cript make this random... jao... :mad: :rolleyes:
     
    frisby, May 16, 2006 IP
  11. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #11
    I don't want them randomly renamed... I want fixed text values
     
    bluemouse2, May 16, 2006 IP
  12. Big 'G'

    Big 'G' Member

    Messages:
    89
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    48
    #12
    so you will provide script a list of valid names
     
    Big 'G', May 16, 2006 IP
  13. DomainMaster

    DomainMaster Banned

    Messages:
    576
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I think you will need an array. Store your names in a .csv file and load them using the script into an array and then do the renaming. I would write a script for you but I don't do freelance work.
     
    DomainMaster, May 16, 2006 IP
  14. Psychotomus

    Psychotomus Guest

    Messages:
    427
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #14
    show us what you have so far.
     
    Psychotomus, May 16, 2006 IP
  15. bluemouse2

    bluemouse2 Well-Known Member

    Messages:
    4,055
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    185
    #15
    you can write anything instead those names (orange, apple, banana, etc) - I just want to rename 31 files (named from 01 to 31) to 31 fixed values via a script :)
     
    bluemouse2, May 16, 2006 IP
  16. -Abhishek-

    -Abhishek- Regaining my Momentum!

    Messages:
    2,109
    Likes Received:
    302
    Best Answers:
    0
    Trophy Points:
    0
    #16
    Aargh!!! Send 10$ to my paypal ... and will make one of my data entry workers do it for u .!!!You want a godammed script to be coded to rename 31 files ?? And you waited the whole day ??
    In so much time I could have renamed the whole bunch a 100 times!!!
    Abhishek
     
    -Abhishek-, May 16, 2006 IP