PDA

View Full Version : PHP Help



IcePhreak
03-12-2013, 12:51 PM
Hello, i'm having a problem with a PHP code. I cba to post here it's pretty complicated!! If anyone could add my skype and try to help I would be very greatful. PM me please. It has to do with a PHP fetch image script.

Trinity
03-12-2013, 10:38 PM
I cba to post here it's pretty complicated!!

Wait, so you can't be bothered spending the little bit of time it would take to post the code, but you want someone else to spend their time helping you out?
You couldn't even be bothered to explain the problem, or post an error message or anything?

IcePhreak
03-12-2013, 11:29 PM
Wait, so you can't be bothered spending the little bit of time it would take to post the code, but you want someone else to spend their time helping you out?
You couldn't even be bothered to explain the problem, or post an error message or anything?

See the thing is there is no error codes as its a fetch image script. I'll give the low down... Sorry about that.

So I got this layout from here http://habboemotion.com/resources/fansitelayout/17/ I went and installed on my website here http://boomradio.site11.com/17/

As you can see the Navigation, News, and Stats bars don't appear on the left. I've double checked that the image and php script are correct. This layout apparently uses a header.php to fetch the top.png

Trinity
04-12-2013, 12:06 AM
See the thing is there is no error codes as its a fetch image script. I'll give the low down... Sorry about that.

So I got this layout from here http://habboemotion.com/resources/fansitelayout/17/ I went and installed on my website here http://boomradio.site11.com/17/

As you can see the Navigation, News, and Stats bars don't appear on the left. I've double checked that the image and php script are correct. This layout apparently uses a header.php to fetch the top.png

It looks like you don't have the right font installed on the server. Header.php shows this error if you look at the source:


<b>Warning</b>: imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in <b>/home/a6506051/public_html/17/header.php</b> on line <b>7</b>

IcePhreak
04-12-2013, 12:13 AM
It looks like you don't have the right font installed on the server. Header.php shows this error if you look at the source:


<b>Warning</b>: imagettftext() [<a href='function.imagettftext'>function.imagettftext</a>]: Could not find/open font in <b>/home/a6506051/public_html/17/header.php</b> on line <b>7</b>

How can I fix this i have the volterb.tff in my folder...

Trinity
04-12-2013, 12:24 AM
How can I fix this i have the volterb.tff in my folder...

.tff? Shouldn't it be .ttf? Check you've not made a typo in the code or the filename, and then post header.php here.
You could also try specifying the full path to the font file, if it's not done already.

IcePhreak
04-12-2013, 12:29 AM
.tff? Shouldn't it be .ttf? Check you've not made a typo in the code or the filename, and then post header.php here.
You could also try specifying the full path to the font file, if it's not done already.

Sorry, yes I did mean ttf.. lol. Here is the header code.


<?php
header("Content-type: image/png");
$text = $_GET['t'];
$im = imagecreatefrompng("images/top.png");
$font = "volterb.ttf";
$white = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 7, 0, 9, 14, $white, $font, $text);
imagepng($im);
imagedestroy($im);
?>

Trinity
04-12-2013, 12:48 AM
Sorry, yes I did mean ttf.. lol. Here is the header code.


<?php
header("Content-type: image/png");
$text = $_GET['t'];
$im = imagecreatefrompng("images/top.png");
$font = "volterb.ttf";
$white = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 7, 0, 9, 14, $white, $font, $text);
imagepng($im);
imagedestroy($im);
?>

Read through this: http://www.php.net/imagettftext
Specifically this part:

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.

So giving it an absolute path to the font (like $font = 'http://blablabla.com/bla/volterb.ttf') should work, if that's what's causing the problem.
Or something like this: http://board.phpbuilder.com/showthread.php?10237365-GD-ImagettfText-font-not-found&p=10332311&viewfull=1#post10332311

IcePhreak
04-12-2013, 12:53 AM
Read through this: http://www.php.net/imagettftext
Specifically this part:


So giving it an absolute path to the font (like $font = 'http://blablabla.com/bla/volterb.ttf') should work, if that's what's causing the problem.
Or something like this: http://board.phpbuilder.com/showthread.php?10237365-GD-ImagettfText-font-not-found&p=10332311&viewfull=1#post10332311
I tried specifying to that and it still didn't work :/

Want to hide these adverts? Register an account for free!