gzip image files
| From: | Keith Whyman | Date: | Tue, 27 Nov 2001 14:23:37 +0000 |
| Subject: | gzip image files | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-14590@lists.php.net to get a copy of this message | ||
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