 |
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
 | This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 15th, 2009, 09:01 PM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Ch 7 imagettftext function failing to find fonts
I am new to all of this and I have been struggling to get the imagettftext() function to work as it is written in the chapter 7 code.
The putenv('GDFONTPATH=' . 'C:/Windows/Fonts') does not seem to facilitate the use of fonts in the Windows font folder...
This bit of code below is taken from the book:
PHP Code:
//change this path to match your fonts directory and the desired font putenv('GDFONTPATH=' . 'C:/Windows/Fonts'); $font = 'arial';
(SNIP)
// add the caption if requested if (isset($_GET['capt'])) { imagettftext($image, 12, 0, 20, 20, 0, $font, $_GET['capt']); }
The only way I have gotten it to work is to set $font = 'arial.ttf' and place the arial.ttf file into my ...apache2.2/htdoc folder.
I would love to know why the putenv call is not working; any help would be appreciated.
Thanks
-K
|
|

April 29th, 2009, 08:04 AM
|
|
Authorized User
|
|
Join Date: Sep 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah, I'm getting the same error.
Tried copying the font into my htdocs folder, but that didn't work either.
Anyone knows why this is? Tried switching the /'s with \'s, but didn't help.
|
|

January 27th, 2010, 08:37 AM
|
|
Registered User
|
|
Join Date: Jan 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Chapter 7 Image Caption & Watermark?
Me too i cant even get the above workaround to work...
I can't get the Caption & Watermark to work on page 202 onwards?!
I have downloaded the original code...changed the paths to my htdocs. But this still doesn't work....everything else but this.
Help.
|
|

February 13th, 2010, 01:48 AM
|
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 25
Thanks: 1
Thanked 4 Times in 4 Posts
|
|
Solution or workaround
I replaced the two relevant lines of codes at the top of both check_image.php and image_effect.php with the following:
Code:
putenv("GDFONTPATH=" . "C:/Windows/Fonts/");
$font = getenv('GDFONTPATH') . 'arial.ttf';
This solved the problem, at least on Windows Vista.
HTH,
Boz
|
|

February 13th, 2010, 02:22 AM
|
|
Authorized User
|
|
Join Date: Jan 2010
Posts: 25
Thanks: 1
Thanked 4 Times in 4 Posts
|
|
And BTW, don't put any debugging statements in the image_effect.php file, like echo $font, or anything else that causes output. Because this file is called as the src attribute of an image element, it can only generate an image, not text output. When I tried to use echo to see what my variables and arrays were holding, the check_image program tried to put that where it expected an image. The result was no image, and annoyingly, no output or even an error message in the php-error log.
I think using an image generating program as the src attribute is pretty cool. But if anyone knows a way to get error and debugging info out of it, I'd love to here it. There must be a way to use stderr or stdout to do this on Linux, but on Windows? Any ideas?
Regards,
Boz
|
|

March 3rd, 2010, 12:02 PM
|
|
Authorized User
|
|
Join Date: Dec 2009
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by BozHogan
I replaced the two relevant lines of codes at the top of both check_image.php and image_effect.php with the following:
Code:
putenv("GDFONTPATH=" . "C:/Windows/Fonts/");
$font = getenv('GDFONTPATH') . 'arial.ttf';
This solved the problem, at least on Windows Vista.
HTH,
Boz
|
After this replaced lines i have the same problem... The code does'nt work!
Can you Help me?
|
|
 |