Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

ttf text in PHP error

images php coding issues or problems here.

Moderators: macek, egami, gesf

ttf text in PHP error

Postby shyguy1 » Wed Oct 09, 2002 7:16 am

Hi, i've created a banner-creation-tool which uses Javascript for color selection and PHP for doing the images. I use 4 scripts taht are doing basically the same job. one is for banner with background, another for banner with background color *2 for jpg and png. The scripts use also TTF fonts for doing the text. Anyway the scripts did their work since a few weeks ago. Now they show a warning that says "could not find/open font in" .
I controlled if the fonts have been deleted or if the access rights have been modified, but everything was like the first time.
I've thought at a PHPversion-change by my provider, but they couldn't help me.

the 1st script is this one: (there's the same error message at all 4 scripts)

--------------------------------

<?php
Header("Content-type: image/png");
$im = imagecreatefrompng("$bg");
$color1 = ImageColorAllocate($im, $r_t1, $g_t1, $b_t1);
$color2 = ImageColorAllocate($im, $r_t2, $g_t2, $b_t2);
$color3 = ImageColorAllocate($im, $r_t3, $g_t3, $b_t3);
ImageTTFText ($im, $size, 0, $posizione, $size+$altezza, $color1, $font1, $string1);
ImageTTFText ($im, $size2, 0, $posizione2, $size2+$altezza2, $color2, $font2, $string2);
ImageTTFText ($im, $size3, 0, $posizione3, $size3+$altezza3, $color3, $font3, $string3);
ImagePng ($im);
ImageDestroy ($im);
?>

--------------------------------

I hope somebody can tell me why the problem appeared and provide me a solution/alternative!

Thank you very much for interesting in my problem,
Magnus Moosreiner

URL: http://bannercreator.publixchange.net
Last edited by shyguy1 on Wed Oct 09, 2002 7:54 am, edited 1 time in total.
shyguy1
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Oct 09, 2002 6:52 am

Postby Xerpher » Wed Oct 09, 2002 7:36 am

Well when I went your link and tried it out I got this error:

Code: Select all
<br />
<b>Warning</b>:  Could not find/open font in <b>/home/publixchange/www/banner.php</b> on line <b>7</b><br />
<br />
<b>Warning</b>:  Could not find/open font in <b>/home/publixchange/www/banner.php</b> on line <b>8</b><br />
<br />
<b>Warning</b>:  Could not find/open font in <b>/home/publixchange/www/banner.php</b> on line <b>9</b><br />
‰PNG


So maybe you need to either make sure those fonts are on your server or change the fonts your currently using... But I could be wrong :) its just a guess.
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby shyguy1 » Wed Oct 09, 2002 7:50 am

:cry: yes, I know... But the fonts are the same as they were when it functioned... Thank you anyway
shyguy1
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Oct 09, 2002 6:52 am

Postby Xerpher » Wed Oct 09, 2002 7:56 am

What has changed since it was working?
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Postby shyguy1 » Wed Oct 09, 2002 8:00 am

I did not change NOTHING... I were in holiday 8)
shyguy1
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Oct 09, 2002 6:52 am

Postby Xerpher » Wed Oct 09, 2002 8:22 am

8O ummm, hmmmmm, I would ask your server about it... maybe they changed something (unless your the one running your server)
Xerpher
New php-forum User
New php-forum User
 
Posts: 164
Joined: Tue Aug 27, 2002 8:25 pm
Location: Ontario, Canada

Re: ttf text in PHP error

Postby WiZARD » Sun Oct 20, 2002 10:27 pm

shyguy1 wrote:Hi, i've created a banner-creation-tool which uses Javascript for color selection and PHP for doing the images. I use 4 scripts taht are doing basically the same job. one is for banner with background, another for banner with background color *2 for jpg and png. The scripts use also TTF fonts for doing the text. Anyway the scripts did their work since a few weeks ago. Now they show a warning that says "could not find/open font in" .
I controlled if the fonts have been deleted or if the access rights have been modified, but everything was like the first time.
I've thought at a PHPversion-change by my provider, but they couldn't help me.

the 1st script is this one: (there's the same error message at all 4 scripts)

--------------------------------

<?php
Header("Content-type: image/png");
$im = imagecreatefrompng("$bg");
$color1 = ImageColorAllocate($im, $r_t1, $g_t1, $b_t1);
$color2 = ImageColorAllocate($im, $r_t2, $g_t2, $b_t2);
$color3 = ImageColorAllocate($im, $r_t3, $g_t3, $b_t3);
ImageTTFText ($im, $size, 0, $posizione, $size+$altezza, $color1, $font1, $string1);
ImageTTFText ($im, $size2, 0, $posizione2, $size2+$altezza2, $color2, $font2, $string2);
ImageTTFText ($im, $size3, 0, $posizione3, $size3+$altezza3, $color3, $font3, $string3);
ImagePng ($im);
ImageDestroy ($im);
?>

--------------------------------

I hope somebody can tell me why the problem appeared and provide me a solution/alternative!

Thank you very much for interesting in my problem,
Magnus Moosreiner

URL: http://bannercreator.publixchange.net


Hi!
In your code you write:
Code: Select all
ImageTTFText ($im, $size, 0, $posizione, $size+$altezza, $color1, $font1, $string1);

Whats is $string1
Maby you have a mistake in this string?
User avatar
WiZARD
Moderator
Moderator
 
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol


Return to PHP coding => Images

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.