473,461 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[GD]Could not find/open font - font problem

I know this subjekt was up several times but Icant get it work
use gd2 on win32
Expand|Select|Wrap|Line Numbers
  1. <?
  2. putenv('GDFONTPATH=f:\swd\font');
  3. $font = "f:/swd/font/arial.ttf";
  4. $im = imagecreate (250, 28);
  5. $black = ImageColorAllocate ($im, 0, 0, 0);
  6. $yellow = ImageColorAllocate ($im, 235, 235, 51);
  7. ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
  8. "comming text or not?");
  9. ImagePNG($im,test.png);
  10.  
  11. ?>
  12. <img src="test.png" alt="image">
but I allway get error about not finding font ..

what should I do?
Jul 17 '05 #1
3 21463
Not sure, becouse it looks right, but what about the forward slash?

I take it this is a windows install? try: $font =
"f:\\swd\\font\\arial.ttf";
--
Mike Bradley
http://www.gzentools.com -- free online php tools
"carramba" <ca******@bootre.com> wrote in message
news:a4*************************@posting.google.co m...
I know this subjekt was up several times but Icant get it work
use gd2 on win32
<?
putenv('GDFONTPATH=f:\swd\font');
$font = "f:/swd/font/arial.ttf";
$im = imagecreate (250, 28);
$black = ImageColorAllocate ($im, 0, 0, 0);
$yellow = ImageColorAllocate ($im, 235, 235, 51);
ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
"comming text or not?");
ImagePNG($im,test.png);

?>
<img src="test.png" alt="image">

but I allway get error about not finding font ..

what should I do?

Jul 17 '05 #2
jn
"carramba" <ca******@bootre.com> wrote in message
news:a4*************************@posting.google.co m...
I know this subjekt was up several times but Icant get it work
use gd2 on win32
<?
putenv('GDFONTPATH=f:\swd\font');
$font = "f:/swd/font/arial.ttf";
$im = imagecreate (250, 28);
$black = ImageColorAllocate ($im, 0, 0, 0);
$yellow = ImageColorAllocate ($im, 235, 235, 51);
ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
"comming text or not?");
ImagePNG($im,test.png);

?>
<img src="test.png" alt="image">

but I allway get error about not finding font ..

what should I do?


I hate that bug. I got mine to work on Windows and Linux by only giving it
the font name (it adds .ttf by itself) and by using realpath().

Create a folder called "font" where your script is, and put your font there.

<?

$fontpath = realpath('./font/');
putenv('GDFONTPATH='.$fontpath);
$font = "arial";
$im = imagecreate (250, 28);
$black = ImageColorAllocate ($im, 0, 0, 0);
$yellow = ImageColorAllocate ($im, 235, 235, 51);
ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?");
ImagePNG($im,test.png);
?>

<img src="test.png" alt="image">

I hope this works for you...
Jul 17 '05 #3
"jn" <us********************************@jasonnorris.ne t> wrote in message news:<7h*********************@twister.tampabay.rr. com>...
"carramba" <ca******@bootre.com> wrote in message
news:a4*************************@posting.google.co m...
I know this subjekt was up several times but Icant get it work
use gd2 on win32
<?
putenv('GDFONTPATH=f:\swd\font');
$font = "f:/swd/font/arial.ttf";
$im = imagecreate (250, 28);
$black = ImageColorAllocate ($im, 0, 0, 0);
$yellow = ImageColorAllocate ($im, 235, 235, 51);
ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font,
"comming text or not?");
ImagePNG($im,test.png);

?>
<img src="test.png" alt="image">

but I allway get error about not finding font ..

what should I do?

I hate that bug. I got mine to work on Windows and Linux by only giving it
the font name (it adds .ttf by itself) and by using realpath().

Create a folder called "font" where your script is, and put your font there.

<?

$fontpath = realpath('./font/');
putenv('GDFONTPATH='.$fontpath);
$font = "arial";

Thanx you very mutch! it worked like a rolex! hehe
that was a nasty bug... and with bad documentation, according php.net
it should by enought to point with absolut path..

enyway, thank you!


$im = imagecreate (250, 28);
$black = ImageColorAllocate ($im, 0, 0, 0);
$yellow = ImageColorAllocate ($im, 235, 235, 51);
ImageTTFText ($im, 20, 0, 10, 20, $yellow, $font, "comming text or not?");
ImagePNG($im,test.png);
?>

<img src="test.png" alt="image">

I hope this works for you...

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Slavik | last post by:
All libraries were installed (precompiled) This is FreeBSD 5.1 installed zlib, installed jpeg and png libraries (in default directories) GD 2.0.11 source is in /usr/gd-2.0.11 (compiled and...
4
by: xcomm | last post by:
I tried to create some images with php and gd and get always Call to undefined function imagejpeg() or Call to undefined function imagepng() PHP was build with --with-gd --with-zlib but I...
1
by: D. Alvarado | last post by:
Hello, I am trying to install the GD package. I am runinng PHP 4 for Apache 1.3.31 on Linux Fedora Core 2. This is the command I run ... # ./configure --with-mysql --enable-calendar...
2
by: Brad Shinoda | last post by:
I've been running apache and PHP by using apt-get packages for a long time now, and it's been working fine for me. But the other day I tried to get image functions working and hit a brick wall with...
3
by: Bob Baddeley | last post by:
I'm running PHP5 on a WinXP box using Apache2. I am having an unusual problem and can't find a solution online at all. I believe I have enabled the GD module properly. I modified the php.ini and...
0
by: Akkad | last post by:
ok let met tell u what is the problem , i have downloaded the code GD library code from interent and when i am using it the picture is not appearing on the page. i don't know why ? i am using PHP...
4
by: Sebastian.Pawlus | last post by:
Hi, I have a problem with Chinese words coded in utf-8. I need to display Chinese marks/words with use of GD or IMagick libs. Chinese text that I need to display is written as plain text in .txt...
6
by: Jeff | last post by:
I need to rewrite some image resizing code from perl to php. Although I'm currently using Image Magick in perl, the function reference is so different, that I'll completely need to rewrite it....
0
by: serdar | last post by:
Has anyone created a GD font to use with imageloadfont() function in GD library? I need a tutorial or some guidelines if you have any. I particularly need the GD version of bitmap Tahoma Bold 10px...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.