visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: Bizarre PHP errors...?


By: Kre8 U.S.A.  Date: 05/08/2003 00:00:00  English  Points: 300 Status: Answered
Quality : Excellent
The exact warnings outputed is

Warning:  in /usr/www/virtual/our/<A HREF="http://www.domain.com/admin/galz1/uploader.php">www.domain.com/admin/galz1/uploader.php</a> on line 33

Warning: src_img in /usr/www/virtual/our/<A HREF="http://www.domain.com/admin/galz1/uploader.php">www.domain.com/admin/galz1/uploader.php</a> on line 60

Not sure if the 1st warning will display properly but it is Warning: a square box in /usr/ww/ on line 33

The two lines in question that have recently started outputting this warning are as below

line 33
$box = imagettfbbox ($text_size,0,$font_file,$copyright_text);

line 60
$text1 = imagettftext($src_img,$size,$angle,$xc,$yc,$outlinecol,$fontfile,$text);

As you can see both lines are to do with true type fonts on images so im guessing thats where the problem lies.:)

Since the errors started appearing, the script has stopped adding the copyright text that it should do.

Any ideas on whats causing the errors and how i can get it working again?

Thanks:)

By: wtgee Date: 05/08/2003 21:31:00 English  Type : Comment
Did the script work before and then just suddenly stop?

Make sure the font_file is located where you say it is located. In line 33 you are using $font_file and in line 60 you are using $fontfile....is this intentional?

Line 60 looks like it is having problems with the $src_img...is that setup correctly with an imagecreate() ?
By: Kre8 Date: 05/08/2003 22:08:00 English  Type : Comment
Hi wtgee,

Yeah, the script worked fine for 3 months and then about a week ago it decided to start throwing up warnings:( The actual script still works in that it takes an uploaded file, resizes it and copies it elsewhere, however it should also add copyright text which it isnt and instead outputting the warnings...

Sorry about the font_file, line 60 is actually within a function that gets passed $fontfile.

I've put together a test script using the basics of the actual script and enclosed it below, however this script is still outputting the warnings:(

$img = imagecreate(100,50);
$white = imagecolorallocate($img,255,255,255);
$black = imagecolorallocate($img,0,0,0);
$font_file = '/www/virtual/absolute/path/to/<A HREF="http://www.our-domain.com/php_font_upload_directory/arial.ttf">www.our-domain.com/php_font_upload_directory/arial.ttf</a>';
$font_size = 12;
$angle = 0;
$horz_pos = 20;
$vert_pos = 25;
$text = "Testing";
imagerectangle($img,0,0,99,49,$black);
ImageTTFText($img, $font_size, $angle, $horz_pos, $vert_pos, $black, $font_file, $text);
header("Content-type:image/jpeg");
imagejpeg($img);
imagedestroy($img);

I've even tried the simple examples from php.net for imagettfftext but still get same warnings:(

I did find this <A HREF="http://bugs.php.net/bug.php?id=15568">http://bugs.php.net/bug.php?id=15568</a> which suggest is possible a bug in an older version of php, but the server in question is running PHP 4.2.3
By: wtgee Date: 05/08/2003 23:36:00 English  Type : Comment
Is it a hosted server? If so they might have recently upgraded to 4.3 which might have an error somewhere.

I will check out the script in a bit. Apparently I am supposed to be working or something. :)
By: sumotimor Date: 05/08/2003 23:52:00 English  Type : Comment
Try using a different font, or downloading a replacement arial.ttf font.
By: VGR Date: 06/08/2003 00:17:00 English  Type : Comment
check this line in your editor :

line 33
$box = imagettfbbox ($text_size,0,$font_file,$copyright_text);

searching for binary unprintable characters in a bad location

***or***

check that no variable in the call "suddenly" lost it's value and contains binary
By: Kre8 Date: 06/08/2003 00:44:00 English  Type : Comment
Hi wtgee,

Yes its a hosted server, though is currently running PHP 4.2.3, cheers for taking a look.

VGR,

i rewrote the script and included in above post to explicitly set the variables before the call and still get the errors:(

Cheers:)
By: VGR Date: 06/08/2003 01:11:00 English  Type : Comment
and if you isolate the block of lines containing the "error" ? Does the error still show ?
By: wtgee Date: 06/08/2003 01:24:00 English  Type : Comment
I don't know...the fact that you coldn't create the box and couldn't write the text tells me it is something with the TTF from your server. Can you do just an imagestring() and get it to display properly?

I would ask your server if they have made any changes and see what they say.
By: VGR Date: 06/08/2003 01:42:00 English  Type : Comment
usually, a web host answers "we haven't changed anything" ;-)

especially if they did :D
By: VGR Date: 06/08/2003 01:44:00 English  Type : Answer
well, the problem is that the error messages seem to indicate a problematic PHP installation...

Warning:  in ...
Warning: src_img in ...

have no sense at all and are not errors

I suggest they restart the webserver :D
By: wtgee Date: 06/08/2003 01:46:00 English  Type : Assist
I agree that the problem is not yours but theirs (isn't it always that way).
By: Kre8 Date: 06/08/2003 20:19:00 English  Type : Comment
wtgee & VGR,

I can use other image drawing functions fine and it draws the box in the test script, it just refuses to budge about the text thing though...

I have already asked host and suprise, suprise they deny all knowledge of having changed anything lol.

Going to try using imagestring() instead and see if can work a way around it:)

Will let you know and split points:)

Do register to be able to answer

EContact
browser fav
page generated in 371.179820 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page