if ($method == 'imagick_ext') { $im = new Imagick($_f); # $im->adaptiveResizeImage($max_x, $max_y, $bestfit = true); $im->thumbnailImage($max_x, $max_y, $bestfit = true); $im->writeImage($_s); $cmd = $_f . ' -> ' . $_s; } elseif ($method == 'convert') { $cmd = 'convert ' . $_f . ' -resize ' . $max_x . 'x' . $max_y . '^ ' . $_s; $result = exec($cmd); } echo $cmd . ' ' . round(microtime(true) - $ts, 3) . ' sec' . PHP_EOL; } } foreach (glob('./*/*/') as $dir) { $to_resize = []; foreach (glob($dir . 'product_*_full.jpg') as $img_full) { $img_small = str_replace('_full.jpg', '_small.jpg', $img_full); if (!filesize($img_full)) { continue; } if (file_exists($img_small) && !$force_resize) { continue; } $to_resize[$img_full] = $img_small; } _resize($to_resize); } # HINT: to remove all small images: # find . -type f -name '*small*' | xargs rm -v # _OR_ (slightly faster): # find . -type f -name '*small*' -exec rm {} \;
function _put(&$db, $case) { switch ($case) { case 'split': $task2id = _split_task(GETPOST('taskid'), GETPOST('tache1'), GETPOST('tache2')); print json_encode(_task($db, $task2id)); break; case 'task': print json_encode(_task($db, (int) GETPOST('id'), $_REQUEST)); break; case 'sort-task': _sort_task($db, $_REQUEST['TTaskID'], $_REQUEST['list']); break; case 'reset-date-task': _reset_date_task($db, (int) GETPOST('id_project'), (double) GETPOST('velocity') * 3600); break; case 'coord': _coord($db, $_POST['coord']); break; case 'sort-task-ws': print _sort_task_ws($db, GETPOST('TTaskID')); break; case 'ws': print json_encode(_task_ws($db, GETPOST('taskid'), GETPOST('fk_workstation'))); break; case 'resize': return _resize($db, $_POST['coord']); break; case 'set-user-task': print _set_user_in_task(GETPOST('taskid'), GETPOST('userid')); break; case 'remove-user-task': print _remove_user_in_task(GETPOST('taskid'), GETPOST('userid')); break; } }