Skip to content

Instantly share code, notes, and snippets.

@leepettijohn
Created January 9, 2018 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leepettijohn/80c7096fc130bf2d9ce6ea2020579546 to your computer and use it in GitHub Desktop.
Save leepettijohn/80c7096fc130bf2d9ce6ea2020579546 to your computer and use it in GitHub Desktop.
Create a zip folder from media
<?
function create_zip_file(){
$zip = new ZipArchive();
$filename = "test114.zip";
if ($zip->open($filename, ZipArchive::CREATE)!==TRUE) {
exit("cannot open <$filename>\n");
}
$zip->addFile($_SERVER['DOCUMENT_ROOT']."/wp-content/uploads/2018/01/Bus-Card-ABC-Domestic-Live-Kelly-Ryan.jpg");
$zip->close();
}
add_action ('genesis_after_header','create_zip_file');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment