Wrox Programmer Forums
|
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
 
Old April 15th, 2009, 09:01 PM
Registered User
 
Join Date: Apr 2009
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post
Default 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($image12020200$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
 
Old April 29th, 2009, 08:04 AM
Authorized User
 
Join Date: Sep 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to peirix
Default

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.
 
Old January 27th, 2010, 08:37 AM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
 
Old February 13th, 2010, 01:48 AM
Authorized User
 
Join Date: Jan 2010
Posts: 25
Thanks: 1
Thanked 4 Times in 4 Posts
Default 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
 
Old February 13th, 2010, 02:22 AM
Authorized User
 
Join Date: Jan 2010
Posts: 25
Thanks: 1
Thanked 4 Times in 4 Posts
Default

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
 
Old March 3rd, 2010, 12:02 PM
Authorized User
 
Join Date: Dec 2009
Posts: 14
Thanks: 3
Thanked 0 Times in 0 Posts
Unhappy

Quote:
Originally Posted by BozHogan View Post
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?





Similar Threads
Thread Thread Starter Forum Replies Last Post
CH. 7 imagettftext function error ttpdotcom BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 January 29th, 2010 01:12 PM
VBScript find missing number function?? mat41 Classic ASP Professional 6 February 12th, 2007 07:07 PM
Function to find if a letter is in a word jfrizelle Access VBA 2 January 29th, 2007 05:44 PM
Function to Find a Record me2357 Access VBA 5 March 10th, 2005 03:22 PM
Ch 17: where to find free pop access / forwarding dmswdev JSP Basics 1 June 27th, 2003 05:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.