473,386 Members | 1,883 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 21453
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.