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_shop_products_images', 'o'); $productId = (int)($_POST['product_id'] ?? 0); $mdb->insert('pp_shop_products_images', [ 'product_id' => $productId > 0 ? $productId : null, 'src' => substr($filePath, 5), 'o' => $order + 1, ]); $imageId = (int)$mdb->id(); } plupload_send_success([ 'data_link' => str_replace('../../', '', $filePath), 'image_id' => $imageId, ]);