Page 1 of 1

fpdf giving me errors

Posted: 14 May 2008, 17:54
by atomicbob
Seems like I'm getting an old error that was supposedly fixed in version 0.7 (I'm using 0.8.0 and have gotten the same error in 0.9.1). The error I'm getting is the same one found in this bug report: http://www.catsone.com/bugs/?do=details&task_id=63

Basically I am trying to generate a report from a Job Order. This fails because fpdf can't open the image "file" which is a URL to generate a JPG image. I believe the problem is related to permissions. We have an LDAP that people have to authenticate against to view CATS. Since ReportsUI.php calls fpdf.php with the URL I believe the credentials are not passed in correctly. This causes the following error:

FPDF error: Missing or incorrect image file: http:// . . . cats/index.php?m=graphs&a=jobOrderReportGraph&data=0%2C0%2C0%2C0

If I cut and paste this URL into a browser it works just fine, probably because the browser is authenticated.
Code: Select all
        /* Note that the server is not logged in when getting this file from
         * itself.
         */
        // FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
        //        really don't like this... There has to be a way.
        // FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
        //        in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
        $URI = CATSUtility::getAbsoluteURI(
            CATSUtility::getIndexName()
            . '?m=graphs&a=jobOrderReportGraph&data='
            . urlencode(implode(',', $dataSet))
        );

        $pdf->Image($URI, 70, 95, 80, 80, 'jpg');
The old bug report says this was fixed. Does anybody know how it was fixed, whether it should still be fixed and if there is an easy work-around? The FIXME tags refer to passing a cookie, yet this doesn't seem to be the case anymore? Any ideas why and/or what happened? It sure would be nice to have a source code repository we could search through to get easy answers (not that I expect that from this particular project).

Re: fpdf giving me errors

Posted: 20 May 2008, 16:20
by RussH
Sorry Bob... no joy from me.. but I expect this works fine on a vanilla CATS installation?

Re: fpdf giving me errors

Posted: 12 Sep 2008, 16:04
by RussH
Bob, did you ever fix this?

Re: fpdf giving me errors

Posted: 23 Sep 2008, 02:48
by atomicbob
No, I coded around the problem. Basically the problem comes because the code creates a PDF that contains an embedded image. To get the embedded image it makes a web request to a PHP page that creates a chart (just like the ones in other parts of CATS). The problem is that since the user's web browser isn't making the request the authorization credentials are not passed to the PHP page. This causes an error that causes the fpdf process to quit. I basically diagnosed the problem correctly in my original post. I haven't kept up with any updates to see if it has been fixed. Instead . . .

Since the chart is kind of dumb (it is just a bar chart of the information contained within the report), my work-around was to embed a link to the chart instead of throwing the error back.

Re: fpdf giving me errors

Posted: 12 Apr 2015, 18:24
by scott1981
Was this ever fixed???

I can confirm it continues to happen in 0.9.2

Thanks.

Re: fpdf giving me errors

Posted: 13 Apr 2015, 15:13
by RussH
HI Scott - as per your bug report, I can't reproduce this on the cats test site - the report generation works just fine;

http://opencats.org/test/cats/

Re: fpdf giving me errors

Posted: 14 Apr 2015, 17:19
by scott1981
Russ,

I reposted a new github issue but this time I included my server environment in it. Here it goes in case it makes a difference:

System Information

General Information
Operating System: Linux ice.weblocalhost.com 2.6.32-504.12.2.el6.x86_64 #1 SMP Wed Mar 11 22:03:14 UTC 2015 x86_64
Operating System Type: CATS thinks your operating system is UNIX.
PHP Version: 5.5.22
Database Version: MySQL 5.5.42-cll
Installation Directory: /home/vro/public_html/internal/ats.test


It would be really nice to get this working, as it looks fantastic in the demo site :)

Re: fpdf giving me errors

Posted: 15 Apr 2015, 14:49
by scott1981
RussH wrote:HI Scott - as per your bug report, I can't reproduce this on the cats test site - the report generation works just fine;

http://opencats.org/test/cats/
Found a fix (and an opportunity for feature/functionality request). I use htaccess as part of security measures to control who can access cats :)

I figured that removing htaccess fixes the issue. Is there any way that this could work along with htaccess protection?

Thanks.