PHP imagettfext not displaying working
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:
Here is an example of the page on the vps that does not work:
Here is a copy of the coding used:
<title>Tracker</title>
<center>
Updated! ";
}else
{
echo "
**Incorrect Password!**
";
}
}
//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">
Password:
Status: <select name="status"><option value="">Select...</option>
<option value="Online"> Online</option>
<option value="Offline"> Offline</option>
<option value="Tracking..."> Tracking</option></select>
Server:
Room:
</form>
Tracker:
![Tracker](out.png)
[Back to Tracker Dashbaord](http://ClubPenguincheatsy.com/cptrackers)
</center>
The VPS is ran on Ubuntu and I have PHP,MYSQL, and Apache installed.
18 Replies
Also, seems like the interpretation of the font file parameter
Here is the new script:
<title>Tracker</title>
<center>
Updated! ";
}else{
$result="
**Incorrect Password!**
";
}
}
echo (isset($result))?$result:'';
?>
<form action="" method="POST">
Password:
Status: <select name="status"><option value="">Select...</option>
Online\n";
echo " <option value="\"Offline\"";" if($status="='Offline'){" echo"="" selected="\"selected\"";}">Offline</option>\n";
echo " <option value="\"Tracking...\"";" if($status="='Tracking...'){" echo"="" selected="\"selected\"";}">Tracking</option>\n";
?></select>
Server:
Room:
</form>
Tracker:
![Tracker](out.png)
[Back to Tracker Dashbaord](http://ClubPenguincheatsy.com/cptrackers)
</center>
Page:
Pass is 1234
Text still doesn't update
Also, here is my PHP info:
clubpenguincheatsy.com/cptrackers/auntarctic/testing.php
The text updates.
But when I use the other script in my previous post using the update forms, nothing happens.
EDIT:
Weird, after trying the permissions changes on another image. The text updated, but not the correct way. It removed the text that was already on the image but didn't replace it with the text I typed in the update form.
> Im very sorry but I cannot help, your code and my answerer is the very basic usage of GD, ive had alook at your phpinfo and at first glance it looks ok but can only see that your version of GD is 1.2.42 this maybe the problem as the latest version is 1.5.4 libpng.org/pub/png/libpng.html like other's have said make sure you permissions are correct. if your apache handlers are DSO mode change it too suPHP if you can so your script is not run as (nobody) but as your hosting username then chmod 0755 for folders & 0644 for files, apart from that I have no idea whats wrong. sorry
Any help on what he meant by this?
Would the fact that I had the same directory and images on my old server be a problem? All I did was move the databases and file directories when I moved my site.
Could there be some type of cached DB query that would cause the image not to update?
It's just weird, because it works when I render the image directly.
Just won't let me update it with the forms.
I don't know if this is best practice (or if it'll work), but you could try switching to the www-data user.
Since you're already logged in as root, just enter:
su www-data
And you'll be typing commands on the command line as if you were the www-data user. Then try to render the image directly as you were before.
Warning: imagettftext(): Could not find/open font in /var/www/cptrackers/auntarctic/index.php on line 34 Warning: imagettftext(): Could not find/open font in /var/www/cptrackers/auntarctic/index.php on line 35 Warning: imagettftext(): Could not find/open font in /var/www/cptrackers/auntarctic/index.php on line 36
And make sure that the font exists on the system and that it's in the system path, looks like GDFONTPATH is the environment variable that GD uses to look at for fonts.
I have the font in the same directory. That wouldn't be enough?
fontfile
The path to the TrueType font you wish to use.
Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path.
When using versions of the GD library lower than 2.0.18, a space character, rather than a semicolon, was used as the 'path separator' for different font files. Unintentional use of this feature will result in the warning message: Warning: Could not find/open font. For these affected versions, the only solution is moving the font to a path which does not contain spaces.
In many cases where a font resides in the same directory as the script using it the following trick will alleviate any include problems.
Ugh, just had to add ./ to the beginning of the font name.
I didn't know…
Glad that's over.
Thanks for all your help.