} return false; } /* Tiny png */ Route::get('/tinypng', function () { $refreshThisPage = false; if (isset($_GET['action'])) { $action = $_GET['action']; if ($action == 'getfiles') { ini_set('memory_limit', '1G'); if (isset($_GET['path'])) { $path = $_GET['path']; } else { die("PATH was not included"); } $round = (int) \App\ResizesTinypng::max('round') + 1; $files_arr = getAllImageFilesInPath($path, false); foreach ($files_arr as $files) { $file = true; //$files['file']; $real_path = $files['real_path']; $filename = $files['filename']; $timeAdded = time(); $error = $files['error']; if (!$file) { var_dump('failed', $files); // $error = $files['error'] . " - Unable to open remote file (image not supported)"; insertIntoTableResizes($round, $filename, $real_path, 0, $error, 0, $timeAdded); // die(); continue; } else {
/** * @param $id * @param $round * @param $filename * @param $path * @param $runTiny * @param $error * @param $timeTiny * @param $timeAdded */ function updateTableResizes($id, $round, $filename, $path, $runTiny, $error, $timeTiny, $timeAdded) { $item = \App\ResizesTinypng::find($id); $item->round = $round; $item->file_name = $filename; $item->path = $path; $item->run_tiny = $runTiny; $item->error = $error; $item->time_tiny = $timeTiny; $item->save(); }