Page 1 of 1

Share Image and XAMPP 1.6.2

Posted: Thu Jun 21, 2007 11:08 pm
by charliego
Not really a bug but a case of changing php.

Share Image was working fine until i did an update to xampp version 1.6.2 with PHP 5.2.2

The url http://mysite/netjukebox/image.php was giving the following messages:

Warning: imagettftext() [function.imagettftext]: Invalid font filename in C:\Program Files\xampp\htdocs\netjukebox\image.php on line 183
Warning: imagettftext() [function.imagettftext]: Invalid font filename in C:\Program Files\xampp\htdocs\netjukebox\image.php on line 184
Warning: imagettftext() [function.imagettftext]: Invalid font filename in C:\Program Files\xampp\htdocs\netjukebox\image.php on line 185

and a lot of characters.

Changing the following lines in image.php

imagettftext($dst_image, 9, 0, 55, 13, $font_color, 'arial.ttf', $text);
imagettftext($dst_image, 9, 0, 55, 30, $font_color, 'arial.ttf', $bitmap['artist']);
imagettftext($dst_image, 9, 0, 55, 47, $font_color, 'arial.ttf', $bitmap['album']);

in

imagettftext($dst_image, 9, 0, 55, 13, $font_color, 'C:\WINDOWS\Fonts\arial.ttf', $text);
imagettftext($dst_image, 9, 0, 55, 30, $font_color, 'C:\WINDOWS\Fonts\arial.ttf', $bitmap['artist']);
imagettftext($dst_image, 9, 0, 55, 47, $font_color, 'C:\WINDOWS\Fonts\arial.ttf', $bitmap['album']);

did solve the problem for me.

"Newer PHP versions seems to have a problem with using the GDFONTPATH evironment variable" was what i found from googling.

Posted: Thu Jun 21, 2007 11:59 pm
by wbartels
I think it is a good idea to add a ttf font to netjukebox:

Code: Select all

// Text
$font		= $cfg['home_dir'] . '/font/DejaVuSans.ttf';
$font_color = imagecolorallocate($dst_image, 0, 0, 99);
imagettftext($dst_image, 8, 0, 55, 13, $font_color, $font, $text);
imagettftext($dst_image, 8, 0, 55, 30, $font_color, $font, $bitmap['artist']);
imagettftext($dst_image, 8, 0, 55, 47, $font_color, $font, $bitmap['album']);
This will fix your problem and I think it will also work on systems without ttf fonts.
I found a nice looking font witch is also open source: DejaVuSans.ttf
http://dejavu.sourceforge.net/wiki/index.php/Download

Posted: Fri Jun 22, 2007 9:59 am
by charliego
Excellent, thanks a lot for the help.

Posted: Fri Jul 06, 2007 12:48 am
by wbartels
Implemented in netjukebox 4.02.