Forum Moderators: coopster

Message Too Old, No Replies

PHP Pdf Creation - R&OS - ezImage

         

bilenkyj

12:22 pm on Dec 3, 2008 (gmt 0)

10+ Year Member


Hi Guys,
im using this pdf creation class thats working ok but im having issues with images

im getting the following error -

Warning: feof(): supplied argument is not a valid stream resource in C:\wamp\www\pdf\class.ezpdf.php on line 1306

The script is longer than this show below but you can see the function call here

$pdf->ezImage('http://intranet:81/pdf/Projects/images/testimage.JPG');

Here is the actual function - there is more to it but i think this is the main bit

function ezImage($image,$pad = 5,$width = 0,$resize = 'full',$just = 'center',$border = ''){
//beta ezimage function
if (stristr($image,'://'))//copy to temp file
{
$fp = @fopen($image,"rb");
while(!feof($fp))
{
$cont.= fread($fp,1024);
}
fclose($fp);
$image = tempnam ("/tmp", "php-pdf");
$fp2 = @fopen($image,"w");
fwrite($fp2,$cont);
fclose($fp2);
$temp = true;
}

if (!(file_exists($image))) return false; //return immediately if image file does not exist
$imageInfo = getimagesize($image);
switch ($imageInfo[2]){
case 2:
$type = "jpeg";
break;
case 3:
$type = "png";
break;
default:
return false; //return if file is not jpg or png
}

I have the following configured for my php.ini file -

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On

If i put the local address it will work -

$pdf->ezImage('Projects/images/testimage.JPG');

Any ideas guys?

bilenkyj

12:30 pm on Dec 3, 2008 (gmt 0)

10+ Year Member



does anyone here use this class - do they have some example code they use to add the images?

bilenkyj

3:47 pm on Dec 3, 2008 (gmt 0)

10+ Year Member



just a quick heads up, dont even bother trying to us this rubbish, i know its free but its so so limited to what it can do
unless you are doing basic text and tables cause its trap