Fw: [PHP-DB] gzip image files
| From: | Keith Whyman | Date: | Tue, 27 Nov 2001 14:58:21 +0000 |
| Subject: | Fw: [PHP-DB] gzip image files | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14594@lists.php.net to get a copy of this message | ||
yep tried that one ! :-))
it just writes 1 in the gz file ???
>
>
> > 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" <k.whyman@bf-72.de>
> > To: <php-db@lists.php.net>
> > 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: php-db-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-db-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> > >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-db-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>