0

my client using easy digital download plugin for sell their photos. They upload a zip file that contain many photos and sell this zip file. My need is to extract this zip file and display the images in it in a page.So i need to get all the images from this zip . I need to do some custom work on it. Is there any method to unzip this files via code ? please help .

2

WordPress provides a function called unzip_file()-- easily found by typing "wordpress unzip" into Google. There is sample code in the Codex:

WP_Filesystem();
$destination = wp_upload_dir();
$destination_path = $destination['path'];
$unzipfile = unzip_file( $destination_path.'/filename.zip', $destination_path);

if ( $unzipfile ) {
  echo 'Successfully unzipped the file!';       
} else {
  echo 'There was an error unzipping the file.';       
}

I have no idea what "custom work" you need to do.

2
  • .many thanks s_ha_dum . I need to display this images with some watermark on it, in single product page. Did you know is there any method to watermark on this unziped images . ?. And really thanks for your quick reply. – ron r Jun 4 '15 at 6:00
  • @ronr better ask another question. But please note, read the FAQ first, questions not specific to WordPress are off-topic here in WPSE. – Mayeenul Islam Jun 4 '15 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.