PHP rename an image

Discussion in 'PHP' started by dalv, Jun 8, 2008.

  1. #1
    Hi guys,

    Is there a way I can dynamically rename an image?

    I am using a script to display a random image (one per page), but I want to rename the image on the page to a different name, like "world.jpg"

    How can I do this?
     
    dalv, Jun 8, 2008 IP
  2. clobberx

    clobberx Active Member

    Messages:
    73
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #2
    Can you please elaborate your requirement
     
    clobberx, Jun 8, 2008 IP
  3. dalv

    dalv Well-Known Member

    Messages:
    130
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #3
    Sure.

    I am using Galley2 External Image Block to display a daily image.

    This is the php code for the block:

    This is the output:

    I need it to be renamed or softlined to:

    Does that make sense?
     
    dalv, Jun 8, 2008 IP
  4. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
  5. dalv

    dalv Well-Known Member

    Messages:
    130
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #5
    Thanks.

    I have tried that, but I am not a programmer and can not make it work. I get an error message:

    BTW, just found a funny thing:

    http://www.sitepoint.com/forums/showthread.php?t=552961

    I was Googling how I can use the php rename function and I saw that someone has copied and pasted my EXACT post, word for word... Weird...
     
    dalv, Jun 9, 2008 IP
  6. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #6
    If that's a coincidence, I'm shocked.

    I actually replied on that thread with an indentical reponse to this one accusing you (Sorry!) of multi-forum posting.

    If you show me the code you're using, or add me on MSN (msn@danltn.com) I'd love to have a look.

    Dan
     
    Danltn, Jun 9, 2008 IP
  7. dalv

    dalv Well-Known Member

    Messages:
    130
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    123
    #7
    Thanks! I don't think it is a coincidence... The post was exactly the same, word for word.

    And now I can see that it has been deleted...

    I will send you a pm for the code... Thanks again!
     
    dalv, Jun 9, 2008 IP