php compression for images
<p>I am using following code to zip images folder at once:</p>

<pre><code>&lt;?php
// increase script timeout value
ini_set("max_execution_time", 300);
// create object
$zip = new ZipArchive();
// open archive
if ($zip-&gt;open("my-archive.zip", ZIPARCHIVE::CREATE) !== TRUE) {
die ("Could not open archive");
}
// initialize an iterator
// pass it the directory to be processed
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("images"));
// iterate over the directory
// add each file found to the archive
foreach ($iterator as $key=&gt;$value) {
$zip-&gt;addFile(realpath($key), $key) or die ("ERROR: Could not add file: $key");
}
// close and save archive
$zip-&gt;close();
echo "Archive created successfully.";
?&gt;
</code></pre>

<p>But images are too much to compress at once. I have 70% of the images and want to zip only 30% of the images. Last image name is XYZ.jpg. So i want to zip all images after this last images. But i am not able to figure out how to do this ?</p>
