PDF Support under PHP 5

General discussion about netjukebox
Post Reply
bardelot

PDF Support under PHP 5

Post by bardelot »

Hi,
I'm using PHP 5, so I had to make some changes to support the PDF-Cover generation.

Here are the changes: (cover.php)
1. Step:

Code: Select all

$pdfdfimage = pdf_open_image_file($pdf, 'jpeg', $bitmap['cd_back']);
$sx = 151 / pdf_get_image_width($pdf, $pdfdfimage);
$sy = 118 / pdf_get_image_height($pdf, $pdfdfimage);
=>

Code: Select all

$pdfdfimage = pdf_open_image_file($pdf, 'jpeg', $bitmap['cd_back'], "", 0);
$sx = 151 / pdf_get_value($pdf, "imagewidth", $pdfdfimage);
$sy = 118 / pdf_get_value($pdf, "imageheight", $pdfdfimage);
2. Step:

Code: Select all

pdf_set_font($pdf, 'Helvetica', 3, 'host');
pdf_show_boxed($pdf, $temp, 6.5, 0, 138, 108, 'center');
=>

Code: Select all

$font = PDF_findfont($pdf, "Helvetica", "winansi",0);
pdf_setfont($pdf, $font, 3);  
pdf_show_boxed($pdf, $temp, 6.5, 0, 138, 108, 'center', "");
3. Step:

Code: Select all

pdf_set_font($pdf, 'Helvetica', 4, 'host');
=>

Code: Select all

pdf_setfont($pdf, $font, 4); 
4. Step

Code: Select all

pdf_set_font($pdf, 'Helvetica', 4, 'host');
=>

Code: Select all

pdf_setfont($pdf, $font, 4); 
5. Step

Code: Select all

$pdfdfimage = pdf_open_image_file($pdf, 'jpeg', $bitmap['cd_front']);
$sx = 121 / pdf_get_image_width($pdf, $pdfdfimage);
$sy = 120 / pdf_get_image_height($pdf, $pdfdfimage);
=>

Code: Select all

$pdfdfimage = pdf_open_image_file($pdf, 'jpeg', $bitmap['cd_front'], "", 0);
$sx = 121 / pdf_get_value($pdf, "imagewidth", $pdfdfimage);
$sy = 120 / pdf_get_value($pdf, "imageheight", $pdfdfimage);
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Thanks very much, your help is very appreciated :D :D
I will make the next release PHP 5 compatible.
Did you have any other problems with PHP 5?

I will check if the changed code works with PHP 4.
Otherwise I can use phpversion() to select the right functions.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Nice work, the modified code also works with PHP 4 without any problem :wink:
bardelot

Post by bardelot »

Nice work, the modified code also works with PHP 4 without any problem
Great to hear..
Did you have any other problems with PHP 5?
It looks like httpQ isn't working, but I don't know if it has anything to do with php 5. There's no error, but it's not working :?
Another point is that sometimes the page gets displayed as header & (html) source. Coudn't yet figure out why.

Anyway.. I'm not using Winamp & httpQ, so I changed the Icons and the link to stream the files. Of course the favorites and playlist got useless, but I'm still customizing the whole interface.
Ever thought of using templates? It would be much easier to change everything :D

And what font did you use to create the buttons? I tried to make a new button but it looked awful. :D
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

bardelot wrote:It looks like httpQ isn't working, but I don't know if it has anything to do with php 5. There's no error, but it's not working
Soon I will also install PHP5 and see if I can fix that.
bardelot wrote:Another point is that sometimes the page gets displayed as header & (html) source. Coudn't yet figure out why.
Witch web browser do you use?
I get sometime the same result with PHP4 and the Firefox webbrowser.
With IE I don't have that problem.
bardelot wrote: Ever thought of using templates? It would be much easier to change everything
I don't have the time for that now.
Maybe later.
My first priority is to make it PHP 5 compatible.
bardelot wrote: And what font did you use to create the buttons?
Trebuchet MS, 17 Pixel, Bold and background color: #030350
bardelot

Post by bardelot »

Witch web browser do you use?
I get sometime the same result with PHP4 and the Firefox webbrowser.
With IE I don't have that problem.
Firefox. I'll try to find out why this happens.
Trebuchet MS, 17 Pixel, Bold and background color: #030350
thx :D
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

bardelot wrote:It looks like httpQ isn't working, but I don't know if it has anything to do with php 5. There's no error, but it's not working :?
I have installed PHP 5.04 on Apache 2 and found no problem with httpQ.
Maybe you have forgot to enable the httpQ service in Winamp.

Now that the PDF covers work on PHP 5 it is time to remove the PHP 5 version check :wink:
Post Reply