Forum Moderators: coopster
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?