function match_big_with_small_images() { $content_manager = new ContentManager(); $dimension = array(1300, 1080); // Jen's choice 1300x1080 for ($i = 0; $i <= 15; $i++) { $source_dir = $this->local_destination . "/BotanicalEuropeana_{$i}"; $target_dir = "/Volumes/Eli blue/BotanicalEuropeana_small/{$i}/"; echo "\n {$source_dir}"; $k = 0; foreach (glob("{$source_dir}/*.jpg") as $filename) { /* breakdown when caching $k++; $cont = false; if($k >= 0 && $k < 4000) $cont = true; // if($k >= 4000 && $k < 4500) $cont = true; // if($k >= 4500 && $k < 8000) $cont = true; if(!$cont) continue; */ $parts = pathinfo($filename); if (!file_exists($target_dir . $parts['filename'] . "_" . implode("_", $dimension) . "." . $parts['extension'])) { echo "\n[{$i}-{$k}] re-sizing... [{$filename}]"; $path = str_replace('\\/', '\\/', $filename); $path = str_replace(' ', '\\ ', $path); $destination_path = str_replace('\\/', '\\/', $target_dir); $destination_path = str_replace(' ', '\\ ', $destination_path); $prefix = $parts['filename']; $content_manager->create_smaller_version($path, $dimension, $destination_path . $prefix, implode("_", $dimension)); } else { echo "\n-done- "; } } } }