Re: [PHP] imagettftext() question

2004-05-25 Thread Jason Wong
On Tuesday 25 May 2004 03:52, Mike Rotondo wrote:
>  I've written a script that displays a graph of some data from a text file.
> Beneath each bar in the graph is a text label. I read the php.net
> documentation and it seemed that imagettftext() was the easiest function to
> get text in an image with, so I used that. Here is the text-display code
> (syntax is all correct):
>
> imagettftext($im, 10, 0, $i * 100 + 10, 190, $black, "arial",
> str_pad($candidates[$i][0], 12, " ", STR_PAD_BOTH));
>
> This code works perfectly well on both windows machines I've tried it on,
> but causes an error in the image on both non-windows (Unix variants)
> machines I've tried it on. Does anyone have
> -any idea why its breaking?
> -a solution to get it to work on *nix machines?
> -a different way to display text in an image?

As you haven't stated what error you're getting my guess is that most likely 
it's because you don't have the font file installed on your "non-windows" 
machines. Another thing is that imagettftext() seems to be very finicky and 
needs the full path to the font file.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
One enemy soldier is never enough, but two is entirely too many
-- Murphy's Military Laws n68
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] imagettftext() question

2004-05-24 Thread Mike Rotondo
 I've written a script that displays a graph of some data from a text file.
Beneath each bar in the graph is a text label. I read the php.net
documentation and it seemed that imagettftext() was the easiest function to
get text in an image with, so I used that. Here is the text-display code
(syntax is all correct):

imagettftext($im, 10, 0, $i * 100 + 10, 190, $black, "arial",
str_pad($candidates[$i][0], 12, " ", STR_PAD_BOTH));

This code works perfectly well on both windows machines I've tried it on,
but causes an error in the image on both non-windows (Unix variants)
machines I've tried it on. Does anyone have
-any idea why its breaking?
-a solution to get it to work on *nix machines?
-a different way to display text in an image?

Thanks a lot.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] imagettftext question

2002-05-28 Thread Leotta, Natalie (NCI/IMS)

To change your Image color use ImageFill:

ImageFill($im,$gifwidth,$gifheight,ImageColorAllocate($im,235,235,235));

Then, in your ImageTTFText, you can set the font:

ImageTTFText($im, 11, 0, 20, (540-20),-$black,"../fonts/arial.ttf", "Source:
SEER 12 Program");

I recommend using -$fontcolor for almost everything.  Sometimes it's not as
good for the larger fonts (they look a little stairsteppy) but it's almost
always better for the smaller fonts.

Good luck!

-Natalie

-Original Message-
From: Ziying Sherwin [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 28, 2002 10:59 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [PHP] imagettftext question




In our application, we need to write a UTF8 strings to the image using True 
Type fonts. The php function that we are using is imagettftext. However, we
have the two problems regarding that function:

1. The images that are generated by this function is white fonts on the
black 
   background. But what we want is black fonts on the white background. It 
   seems impossible to set the background color. What we are doing now is to
   call external commands to reverse the color which is rather slow. Is
there
   better way to achieve the same result?

2. We also have long UTF8 stings that need to be broken into several lines. 
   Which php function has the ability to properly break UTF8 strings? And
   how to display multiple lines using imagettftext?

Thanks,
Ziying Sherwin

P.S. I am not on the mailing list, please reply to [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] imagettftext question

2002-05-28 Thread Ziying Sherwin



In our application, we need to write a UTF8 strings to the image using True 
Type fonts. The php function that we are using is imagettftext. However,
we have the two problems regarding that function:

1. The images that are generated by this function is white fonts on the black 
   background. But what we want is black fonts on the white background. It 
   seems impossible to set the background color. What we are doing now is to
   call external commands to reverse the color which is rather slow. Is there
   better way to achieve the same result?

2. We also have long UTF8 stings that need to be broken into several lines. 
   Which php function has the ability to properly break UTF8 strings? And
   how to display multiple lines using imagettftext?

Thanks,
Ziying Sherwin

P.S. I am not on the mailing list, please reply to [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php