PHP imagettfext not displaying working

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 6
Joined: Thu Jun 16, 2011 3:07 pm

Sun Jul 31, 2011 4:16 pm

I used to use a script to change the text on an image via update form.

It worked perfectly at first while I was on a shared host with all modules pre-installed.

I moved to a vps where I had to install everything myself and now the script no longer works.

The php page is able to be displayed but when I update, the text does not show up like it used to.

Here is an example of the page on the shared host that still works: Password is 1234

Here is an example of the page on the vps that does not work: ... untarctic/ Password is 1234

Here is a copy of the coding used:

Code: Select all

<body bgcolor="#4b7bb2">
<font face="arial">
$submit = $_POST['submit']; // Gets If It has been Submitted
if($submit){ // If submitted do this.
$password = $_POST['password']; // Get the password they submitted
$status = $_POST['status']; // Get the status they submitted
$server = $_POST['server']; // Get the server they submitted
$room = $_POST['room']; // Get the room they submitted
//Now We Secure it.
if($password == "1234"){
//Now We Generate the image and stuff.
$im = imagecreatefrompng("in.png");
// Make RGB Colour For Writing
$colour = imagecolorallocate($im, 255, 255, 255); // I want mine in red(This is black). So I am just
//Gonna find out the rgb code
$font = 'BurbankBigRegular-Bold.ttf'; // 
//This ^ Is our font, It has to be the exact name and in the right folder.
//Draw Text
imagettftext($im, 20, 0, 100, 68, $colour, $font, $status);
imagettftext($im, 20, 0, 95, 95, $colour, $font, $server);
imagettftext($im, 20, 0, 85, 127, $colour, $font, $room);
//Create Image
// Destroy - Save Server Resources
echo "<b> Updated! </b>";
echo "<p><b>Incorrect Password!</b></p>";
//This form remebers what they put, so they dont have to keep typing it in.
// $_SERVER['PHP_SELF'] Means Get this document to submit to.
// If you know html this will be familiar.
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" />
<p>Password: <input type="password"  name="password" id="password" value="<?php echo $_POST['password']; ?>"/></p>
<p>Status: <select name="status"> <option value="">Select...</option>
  <option value="Online"> Online</option>
  <option value="Offline"> Offline</option>
  <option value="Tracking..."> Tracking</option>
<p>Server: <input type="text" id="server"  name="server" value="<?php echo $_POST['server']; ?>"/></p>
<p>Room: <input type="text" id="room" name="room" value="<?php echo $_POST['room']; ?>"/></p>
<p><input type="submit" id="submit" name="submit"/></p>

<p><img src="out.png" alt="Tracker" /></P>

<a href=""s>Back to Tracker Dashbaord</a>
The VPS is ran on Ubuntu and I have PHP,MYSQL, and Apache installed.

Post Reply