473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

[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 21454
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.