www.webdeveloper.com
Results 1 to 3 of 3

Thread: imagettftext() not working

  1. #1
    Join Date
    Aug 2012
    Location
    Programming
    Posts
    21

    Question imagettftext() not working

    Hiya,

    I am trying to make a tracker and the code I have used is valid but
    Warning: Wrong parameter count for imagettftext() in /home/a7265961/public_html/blog/update.php on line 12
    comes up.
    Here is my code
    Code:
    <?php
    $submit = $_POST['submit'];
    if($submit) {
    $password = $_POST['password'];
    $status = $_POST['status'];
    $server = $_POST['server'];
    $room = $_POST['room'];
    $lastupdate = "Last Update:".date("Y-m-d H:i:s");
    if($password == "s****") {
    $im = imagecreatefrompng("images/trackerbg.png");
    $colour = imagecolorallocate($im, 0, 0, 0);
    imagettftext($im, 30, 0, 115, 60, $colour, $status);
    imagettftext($im, 30, 0, 120, 95, $colour, $server);
    imagettftext($im, 30, 0, 120, 135, $colour, $room);
    imagettftext($im, 10, 0, 5,  175, $colour, $lastupdate);
    imagepng($im, 'tracker.png');
    imagedestroy($im);
    echo "Updated!";
    }
    else {
    echo "Incorrect Password! Please try again!";
    }
    }
    else {
    
    }
    ?>
    <html>
    <head>
    <title>Acess 1 Tracker</title>
    </head>
    <body>
    <form action="<?php echo $_['PHP_SELF']; ?>" method="POST">
    <p>Tracker Password: <input type="password" name="password" id="password" value="<?php echo $_POST['password']; ?>"></p>
    <p>Status: <input type="text" name="status" id="status" value="<?php echo $_POST['status']; ?>"></p>
    <p>Server: <input type="text" name="server" id="server" value="<?php echo $_POST['server']; ?>"></p>
    <p>Room: <input type="text" name="room" id="room" value="<?php echo $_POST['room']; ?>"></p>
    <p><input type="submit" name="submit" id="submit" value="Update Tracker"></p>
    </form>
    </body>
    </html>
    What's the mistake and please could you fix it.
    Thanks in advanced.
    Cap123
    Last edited by Cap123; 11-18-2012 at 06:30 AM. Reason: Blocking out password

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,386
    Quote Originally Posted by Cap123 View Post
    ...the code I have used is valid...
    If it were valid, you would not be getting that error.

    imagettftext() requires 8 parameters, but you are only supplying 7. Check the manual page to figure out which one you forgot to include.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Aug 2012
    Location
    Programming
    Posts
    21
    Okay, Thanks it turns out I need
    Code:
    <?php
    // Not all the code, BTW.
    $font = "arial.otf";
    imagettftext($im, 30, 0, 115, 60, $colour, $status, $font);
    imagettftext($im, 30, 0, 120, 95, $colour, $server, $font);
    imagettftext($im, 30, 0, 120, 135, $colour, $room, $font);
    imagettftext($im, 10, 0, 5,  175, $colour, $lastupdate, $font);
    imagepng($im, 'tracker.png');
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles