How to get this script to only zip images in directory

[php]<?php
//Get the directory to zip
$filename_no_ext= $_GET[‘directtozip’];

// we deliver a zip file
header("Content-Type: archive/zip");

// filename for the browser to save the zip file
header("Content-Disposition: attachment; filename=$filename_no_ext".".zip");

// get a tmp name for the .zip
$tmp_zip = tempnam ("tmp", "tempname") . ".zip";

//change directory so the zip file doesnt have a tree structure in it.
chdir('user_uploads/'.$_GET['directtozip']);

// zip the stuff (dir and all in there) into the tmp_zip file
exec('zip '.$tmp_zip.' *');

// calc the length of the zip. it is needed for the progress bar of the browser
$filesize = filesize($tmp_zip);
header("Content-Length: $filesize");

// deliver the zip file
$fp = fopen("$tmp_zip","r");
echo fpassthru($fp);

// clean up the tmp zip file
unlink($tmp_zip);

?>[/php]

Which downloads with

[php]http://canvasr.co/public/zip_folders.php?directtozip=public[/php]

I’d like to make the script be able to only download images, and, if possible ignore any image with the suffix “_t.jpeg” which is used in another script I use to generate thumbnails.

Here is the application of all the scripts:

http://canvasr.co/public/canvas.php

New to php, I like it a lot already!
Thanks so much!

Sponsor our Newsletter | Privacy Policy | Terms of Service