Share Image and XAMPP 1.6.2

Fixed and closed topics
Locked
charliego
User
Posts: 27
Joined: Wed Jun 20, 2007 9:54 pm

Share Image and XAMPP 1.6.2

Post 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.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post 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
charliego
User
Posts: 27
Joined: Wed Jun 20, 2007 9:54 pm

Post by charliego »

Excellent, thanks a lot for the help.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Implemented in netjukebox 4.02.
Locked