williamleonard / obblm

Automatically exported from code.google.com/p/obblm
1 stars 0 forks source link

PDF roster error #165

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I got this mail:
------------------------

Hi Nicholas,

thanks for the reply.  I am a total newbie in this so please bear with me.

the php error log says:

[23-Jul-2009 19:35:18] PHP Warning:  imagepng() [<a
href='function.imagepng'>function.imagepng</a>]: Unable to open '' for
writing: No such file or directory in
/Applications/MAMP/htdocs/pdf/bb_pdf_class.php on line 408
[23-Jul-2009 19:35:18] PHP Warning:  imagepng() [<a
href='function.imagepng'>function.imagepng</a>]: Unable to open '' for
writing: No such file or directory in
/Applications/MAMP/htdocs/pdf/bb_pdf_class.php on line 414 

I am running php Version 5.2.6 which installed last week.

Do I need to install FPDF on my server?

Any help is appreciated.

Cheers,

Lorne 

--------------------------

Is this not the error we have seen once before, Daniel?

Original issue reported on code.google.com by Nimda...@gmail.com on 23 Jul 2009 at 10:45

GoogleCodeExporter commented 9 years ago
To answer his question, is it correct to say he does not need to install it on 
his 
server as the fpdf.php file is distributed with OBBLM?

Original comment by funnyfin...@hotmail.com on 23 Jul 2009 at 2:21

GoogleCodeExporter commented 9 years ago
This is done from a function within fpdf when calling imagepng.
        if(!function_exists('imagepng')) 
                 $this->Error('GD extension is required for GIF support');

I notice the bb_pdf_class calls the function without this check.  Is it 
possible he 
does not have this GD extension installed?

http://us2.php.net/manual/en/image.setup.php

http://us2.php.net/manual/en/image.requirements.php

Original comment by funnyfin...@hotmail.com on 23 Jul 2009 at 2:31

GoogleCodeExporter commented 9 years ago
Yes, it's included.

Maybe, I'll ask him.

Original comment by Nimda...@gmail.com on 23 Jul 2009 at 2:51

GoogleCodeExporter commented 9 years ago
Haven't had a look at the code (yet). No, havent seen that error before.
It could be GD related error but I think I made an if-clause excluding the 
OBBLM pic
if no GD support. (And that's the only thing in PDF roster that needs GD.) 

FPDF is distributed with OBBLM. (It's only one file - fpdf.php.)

Which version of OBBLM is Lorne using?

I think the user missing some file(s).

/Daniel

Original comment by blodae@gmail.com on 23 Jul 2009 at 4:36

GoogleCodeExporter commented 9 years ago
Had a quick look at the code that I have. FPDF should report a different error 
if no
GD support, from the imagepng() function. Please ask the user to run phpinfo() 
and
send the resulting page to me.

Also, please ask the user to check that all the files are there, ie:
<obblm dir>/pdf/bb_pdf_class.php
<obblm dir>/pdf/fpdf.php
<obblm dir>/pdf/OBBLM_pdf_logo.png
<obblm dir>/pdf/pdf_roster.php

The second thing thing to check is if there's some security measure in place 
making
php unable to write files (like no write permissions)...or that a temp dir is
missing. (Not entirely sure about the temp dir...I think I picked the pdf dir to
create the temp file in.) FPDF creates (writes to a temp file) and uses a mask 
image
file to create (partly) transparent pictures, which the OBBLM logo is.

Please ask him to comment out line 462 in pdf_roster.php to exclude the obblm 
pic and
see if that works (to narrow down the problem):
$pdf->Image('pdf/OBBLM_pdf_logo.png' ...

/Daniel

Original comment by blodae@gmail.com on 23 Jul 2009 at 4:54

GoogleCodeExporter commented 9 years ago
Ops. Forgot about the team picture. Also comment out line 459 in pdf_roster.php:
$pdf->Image($team->getLogo() ...

/Daniel

Original comment by blodae@gmail.com on 23 Jul 2009 at 5:48

GoogleCodeExporter commented 9 years ago
Hi Daniel,

I have attached the phpinfo details as an rtf file.  pretty much everything 
that is in MAMP Pro v1.7.2

I am running the OBBLM v0.7

all files exist in the PDF directory.  

I noticed that I was running out of memory so bumped it up to 32MB instead of 8 
in the php.ini file.

can't access the files from work, but will comment out the 2 lines in the 
pdf_roster.php file this evening when 
I get home.  are jpeg formats easier?

Just to let you know that the same issue also occurs with the graph/stats.  

aside from this everything is really good.... I just need to get the guys 
playing.

cheers,

lorne 

Original comment by lornegib...@me.com on 23 Jul 2009 at 11:42

Attachments:

GoogleCodeExporter commented 9 years ago
Commenting out lines 459 and 462 has enabled the PDF roster once I reset the 
memory back up to 32mb.

Putting the lines back in and I got the same error.

Using jpg files instead of png files for the OBBLM logo and team logos works.

Changing the OBBLM logo to a jpg and having the team logos as png files works.

So it appears to be the OBBLM logo that was causing the problem!

I have no idea why, But I am happy that both the rosters and the graphical 
interface (vis stats) are now 
working! ;-)

I am looking forward to the next version, though i might try it first before i 
change everything over.

Cheers,

Lorne 

Original comment by lornegib...@me.com on 24 Jul 2009 at 12:58

GoogleCodeExporter commented 9 years ago
I'll have a look at making the logo optional.
In the mean time, Daniel, could you send me the sources for the logo?

Original comment by Nimda...@gmail.com on 25 Jul 2009 at 1:21

GoogleCodeExporter commented 9 years ago
wait that made no sense.

What file is this?

Original comment by Nimda...@gmail.com on 25 Jul 2009 at 1:37

GoogleCodeExporter commented 9 years ago
Thanks for the info, Lorne! It narrows down the problem quite a bit.

If I remember correctly I made the logo with transparency (to work with any
background except very dark/black, but then the rest of the text wouldn't be 
visible
either). FPDF makes a temporary mask image file for the transparency and it's
somewhere in that creation the error occurs. I'll scrounge through FPDF a bit 
more later.

My guess is that either it cant create the alpha mapping temp file (which it 
deletes
afterwards, unless something goes wrong) or it cant find the alpha mapping file 
when
needed to complete the pdf. If first - might be dir/file write permissions. If 
second
- the dir is not allowed to read from by apache server? Outside www-root dirs?

/Daniel

PS. jpg doesn't have support for transparency but png and gif has. That's the 
reason
why the jpg works - it doesn't need to make a transparency alpha mapping file. 
;-)

Original comment by blodae@gmail.com on 25 Jul 2009 at 5:26

GoogleCodeExporter commented 9 years ago
Well done - good observation!

Original comment by Nimda...@gmail.com on 27 Jul 2009 at 11:22

GoogleCodeExporter commented 9 years ago
Got some additional info from Lorne via mail.

If it's not file permissions (or permissions in Apache) I'm at a loss ftm.

Either way, I'm going to test with the converted obblm "logo", which works on 
Lornes
mac btw, and if that works on my machine I'll upload it to the repository.

/Daniel

Original comment by blodae@gmail.com on 27 Jul 2009 at 5:51

GoogleCodeExporter commented 9 years ago
Yeah, just make it a .jpg with same background color as the pdf background 
color.

Original comment by Nimda...@gmail.com on 27 Jul 2009 at 10:56

GoogleCodeExporter commented 9 years ago
Logo converted to PNG8 worked for Lorne. Png seems to be the smallest file size 
for
the quality in my non-scientific tests, so that would be preferable. 

I dont remember what graphics tool I used when creating the "logo"...and 
graphics
isn't my field. :-P Why I wanted transparency in the logo was to make it fit on 
other
backgrounds than white. But who would want to waste valuable printer ink on a
background color? Had a hard disk crasch a while ago and lost the "blueprint" 
for the
logo. Got the font somewhere though.

/Daniel

Original comment by blodae@gmail.com on 28 Jul 2009 at 6:28

GoogleCodeExporter commented 9 years ago
It'll do for now. Please upload the change(s).

Original comment by Nimda...@gmail.com on 28 Jul 2009 at 6:43

GoogleCodeExporter commented 9 years ago
Anyone familiar how to do unix stuff on a Mac? (There's a unix somewhere deep 
inside,
right?) The closest I've been to a Mac is looking over the shoulder. :-P

More specifically: how to do a 'ls -la' on a Mac? (How to start a shell on a 
Mac?)

I have a strong suspicion the alpha map temp file wants to be created in obblm 
dir
instead of in pdf dir. (pdf dir would be the natural choice but it seems like 
'.' is
obblm dir since handler.php is there, and calls pdf/pdf_roster.php)

Lorne's pdf dir file permissions should work. The obblm root dir is htdocs, 
which has
more restricted file permissions. I've asked Lorne to move/copy/unzip obblm 
files
into it's own dir below htdocs and change file permissions on that dir, to see 
if
that works.

/Daniel

Original comment by blodae@gmail.com on 29 Jul 2009 at 8:27

GoogleCodeExporter commented 9 years ago
Applications/Utilities/Terminal

Sounds likely that is the problem. 

Original comment by Nimda...@gmail.com on 30 Jul 2009 at 10:45

GoogleCodeExporter commented 9 years ago
If so you could solve it by using chdir() 
http://us.php.net/manual/en/function.chdir.php

I want to release soon. What is the timeframe for this? It's the last issue 
waiting
to be resolved.

Original comment by Nimda...@gmail.com on 30 Jul 2009 at 11:16

GoogleCodeExporter commented 9 years ago
Daniel, take your time and upload it when you can.
For now I have added a local settings file for the pdf roster containing a 
switch
that allows one to disable PDF roster obblm logo + team logo.

Original comment by Nimda...@gmail.com on 1 Aug 2009 at 10:02