1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GD Image change to Random Image already Created

Discussion in 'General Programming Chat' started by killer999, Feb 2, 2012.

  1. killer999

    killer999 Newbie

    Joined:
    May 23, 2010
    Messages:
    16
    Likes Received:
    1
    I want to change this code, so i can upload a random image hosted by me from a list of images, to a user album by a facebook app instead of creat a image by GD.


    What i need to do??


    Code:
    $canvas = imagecreatefromjpeg ("bg.jpg");                                   // background image file
    $black = imagecolorallocate( $canvas, 61, 61, 61 );                         // The second colour - to be used for the text
    $font = "font.ttf";                                                         // Path to the font you are going to use                                                         // font size
    
    imagettftext( $canvas, 15, -1, 51, 60, $black, $font, $name );
    imagettftext( $canvas, 15, -1, 51, 200, $black, $font, $friend );
    
    imagejpeg( $canvas, "img/".$fbid.".jpg", 50 );
    
    ImageDestroy( $canvas );
    
    header("Location: ".$scripturl."upload.php?id=".$fbid."&friends=".$friends."")
    ?>