and if i use

$filename = 'kunden/'.$name.'.png';
$data = fopen($filename, "r");
$contents = fread($data, filesize($filename));
fclose($data);
$gzdata = gzencode($data);
$fp = fopen('kunden/zip/'.$name.'.gz', "w");
fwrite($fp, $gzdata);
fclose($fp);

it writes in the gz file this
Resource id #3



> Yes, it is.
> the return value of fopen is a resource of type file.
> var_dump($data); will show that
> if you want to read the data use : fread($data,$buf);
>
> but I think its better with file() function. The example from the docs
show a better method:
> <?php
> $data = implode("", "bigfile.txt");
> $gzdata = gzencode($data, 9);
> $fp = fopen("bigfile.txt.gz", "w");
> fwrite($fp, $gzdata);
> fclose($fp);
> ?>
>
> Regards,
> Andrey Hristov
> IcyGEN Corporation
> http://www.icygen.com
> BALANCED SOLUTIONS
>
>
> ----- Original Message -----
> From: "Keith Whyman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 27, 2001 4:23 PM
> Subject: [PHP-DB] gzip image files
>
>
> > I create a png dynamically - store the path in mysql.
> >
> > And want to be able to offer the user a zipped version to download
> > Unfortunately haven't been able to get it to work up until now !
> > I'm sure it's something obvious but...........
> >
> >
> > Open the png
> > $data = fopen('kunden/'.$name.'.png', "rb");
> > encode it
> > $gzdata = gzencode($data);
> > where to write
> > $fp = fopen('kunden/zip/'.$name.'.gz', "w");
> > write it
> > fwrite($fp, $gzdata);
> > fclose($fp);
> >
> > what happens is the name gets included in the gz but written to it is
only
> > kunden/example.png
> >
> > Can anyone help ??
> >
> > thanks in advance
> > regards
> > keith
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to