$photo_media->setText($photo_tags); $photo_entry->mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); $photo_entry->mediaGroup->keywords = $photo_media; // We use the AlbumQuery class to generate the URL for the album $album_query = $gp->newAlbumQuery(); $album_query->setUser($user_name); $album_query->setAlbumName($new_album_name); $gp->insertPhotoEntry($photo_entry, $album_query->getQueryUrl()); } if (isset($album_download_directory)) { if (file_exists($album_download_directory)) { $album_names = scandir($album_download_directory); foreach ($album_names as $album_name) { if ($album_name != "." && $album_name != "..") { add_new_album($entry, $gp, $album_download_directory, $album_name); } } $unlink_folder = rtrim($album_download_directory, "/"); require_once '../unlink_directory.php'; $unlink_directory = new unlink_directory(); $unlink_directory->remove_directory($unlink_folder); } $response = 1; } else { $response = 0; } if (isset($_GET['ajax'])) { echo $response; } else { header('location:../index.php?response=' . $response); }
public function make_zip($album_download_directory) { $zipfilename = ""; if (isset($album_download_directory)) { //$zipfilename = 'libs/resources'.DIRECTORY_SEPARATOR.'albums'.DIRECTORY_SEPARATOR.'fb-album_'.date("Y-m-d").'_'.date("H-i-s"); $zipfilename = 'libs/resources/albums/fb-album_' . date("Y-m-d") . '_' . date("H-i-s"); // name of folder starting from the root of the webserver // as in Wordpress /wp-content/themes/ (end on backslash) $folder = dirname($_SERVER['PHP_SELF']) . '/' . $album_download_directory; // Server Root $root = $_SERVER["DOCUMENT_ROOT"]; // source of the folder to unpack $sourcedir = $root . $folder; // target directory // Don't use more than half the memory limit $memory_limit = $this->getMemoryLimit(); $maxsize = $memory_limit / 2; // Is zipping possible on the server ? if (!extension_loaded('zip')) { echo 'Zipping not possible on this server'; exit; } // Get the files to zip $foldercontent = $this->LoadZipFiles($sourcedir); if ($foldercontent === false) { echo 'Something went wrong gathering the file entries'; exit; } // Process the files to zip $zip = $this->ProcessZip($foldercontent, $zipfilename, $maxsize); if ($zip === false) { echo 'Something went wrong zipping the files'; } // clear the stat cache (created by filesize command) clearstatcache(); require_once 'unlink_directory.php'; $unlink_directory = new unlink_directory(); $unlink_directory->remove_directory($album_download_directory); } return $zipfilename; }