0 && (int)($imageMeta[1] ?? 0) > 0; if (!$isValidImage) { @unlink($filePath); plupload_send_error(400, 601, 'Plik nie jest prawidlowym obrazem.'); } $mdb = plupload_create_medoo($database); $order = (int)$mdb->max('pp_articles_images', 'o'); $articleId = (int)($_POST['article_id'] ?? 0); $mdb->insert('pp_articles_images', [ 'article_id' => $articleId > 0 ? $articleId : null, 'src' => substr($filePath, 5), 'o' => $order + 1, ]); $imageId = (int)$mdb->id(); } plupload_send_success([ 'data_link' => str_replace('../../', '', $filePath), 'image_id' => $imageId, ]);