WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP ZIP file creation on a linux box using exec. Create ZIP files containing images
Categories : PHP, Compression, Filesystem Click here to Update Your Picture
Christian Haensel
Date : Jun 04th 2007
Grade : 5 of 5 (graded 1 times)
Viewed : 12487
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Christian Haensel
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

I was looking for a way to create ZIP files containing images on a linux box and ran into several problems. Now I found a way to manage that, thank to the PHP mailing list :o) Below my example.

Of course, this thing is just made to suite my needs, so you need to alter it to make it work for you.

Cheers!

Chris
<?php
$nr 
= $_GET['nr'];
if(
eregi("../", $nr)) {
die(
"No playing with directories here...");
}
$directory = '_kfz_images/'.$nr.'/full/';
$dir = opendir($directory);
$i = 1;
while(
$file = readdir($dir)) {
$dest = "temp/ImageFilename".$nr."_".$i.".jpg";
if(
eregi("jpg", $file)) {
 
copy($directory.$file, $dest);
 
$i++;
}
}
$now = time();
header("Content-Type: application/force-download");
header('Content-Disposition: attachment;
filename="ZIPfileName'
.$now.'_Download.zip"');
exec("zip ".$now."_archive.zip temp/* 2>&1", $output);
readfile($now."_archive.zip");
$tempdir = opendir("temp");
while(
$tempfile = readdir($tempdir)) {
if(
eregi("jpg", $tempfile)) {
 
unlink("temp/".$tempfile);
}
}
?>



Fetching product details from the commission junction website using php
Categories : PHP, FTP, Filesystem, Compression
3 lines of Code to extract Tar, Zip, Gzip etc..
Categories : PHP, Filesystem, PHP Classes, Compression
Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
Selecting a random line from a text file
Categories : PHP, Filesystem, Arrays, Beginner Guides
Convert a File database into MySQL
Categories : PHP, Filesystem, Databases, MySQL, Beginner Guides
Remote File Size
Categories : PHP, Filesystem, HTTP, Sockets
Remote File Saving with PHP - Download and serve a remote file. The content of the file will be updated at fixed intervals.
Categories : PHP, Filesystem, Cache, Sockets, HTTP
Quote For the Day
Categories : PHP, Utilities, Filesystem
How to ifconfig down/up a list of IP's
Categories : Arrays, Strings, Filesystem, PHP
Variable serialization and unserialization. Loading and saving variable structures to and from file.
Categories : Arrays, Filesystem, Variables, Strings, PHP
Finds files on your site, uses UNIX find command.
Categories : Complete Programs, Filesystem, PHP
Introduction to Language Files
Categories : PHP, Filesystem, Beginner Guides
Email attachment code
Categories : PHP, Email, Filesystem
Get the correct extension and MIME types of an image, even when the filename is incorrect.
Categories : PHP, Filesystem, General SQL
Directory TreeView - File Manager & Explorer - FTP - Utility - PHP/HTML -
Categories : PHP, Directories, FTP, Filesystem, HTML and PHP