HM2K - 2008-06-11

Logged In: YES
user_id=512604
Originator: YES

I actually managed to solve this, and it's a 3 part problem.

First off, the problem is in "gif.php" supplied from www.fpdf.org which hasn't been updated since 2003/2004 (v1.52).

The next problem is the "EDITEI" modification done to "gif.php" by the people here at project html2fpdf is TERRIBLE!

Here's what I did:

/*
// READ FILE
if(!($fh = @fOpen($lpszFileName, "rb"))) {
return false;
}
//EDITEI - in order to read remote files (HTTP(s) and FTP protocols)
if ( strpos($lpszFileName,"http") !== false or strpos($lpszFileName,"ftp") !== false )
{
$contents = '';
while (!feof($fh)) $contents .= @fread($fh, 8192);
}
else
{
$contents = @fread($fh,@filesize($lpszFileName) );
}
$this->m_lpData = $contents;
// $this->m_lpData = @fRead($fh, @fileSize($lpszFileName));
fClose($fh);
*/
$this->m_lpData = file_get_contents($lpszFileName);

Next you'll see this:

do {
if(!$this->m_img->load($this->m_lpData, $imgLen = 0)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $imgLen);
}
while($iIndex-- > 0);

CHANGE TO

while($iIndex-- > 0) {
if(!$this->m_img->load($this->m_lpData, $imgLen = 0)) {
return false;
}
$this->m_lpData = substr($this->m_lpData, $imgLen);
}

Note: I was still unable to get this script to work, but at least it's a little closer...