if (!$stmt->execute()) { die('Error : (' . $dbcon->errno . ') ' . $dbcon->error); } $stmt->store_result(); $stmt->bind_result($pid, $a); while ($stmt->fetch()) { $thisArr = explode(',', $a); sort($thisArr); if (count($thisArr) == count($elemIdArr) && $thisArr == $elemIdArr) { $designExists = true; $existingProductId = $pid; } } $stmt->close(); if (!$designExists) { $customImgName = createCustomPrdImage($elements); if ($customImgName == "ERROR") { echo "ERROR"; exit; } $prod_price = $_POST["product_price"]; $customized = 1; $prd_qry = "insert into products (price, mainimg, customized) VALUES (?, ?, ?)"; $ins_stmt = $dbcon->prepare($prd_qry); if (!$ins_stmt) { die('Prepare Error : (' . $dbcon->errno . ') ' . $dbcon->error); } $ins_stmt->bind_param('dsi', $prod_price, $customImgName, $customized); if ($ins_stmt->execute()) { $prodid = $ins_stmt->insert_id; } else {
// imagesavealpha( $finalImg, true ); // $fn = md5(microtime()."new")."_custom.png"; $fn = "custom.png"; $result; if (imagepng($out, "../productImages/" . $fn, 9)) { // if(imagepng($finalImg, "../productImages/".$fn, 9)){ $result = $fn; } else { $result = "ERROR"; } // imagedestroy($finalImg); imagedestroy($img); imagedestroy($out); return $result; } createCustomPrdImage($elements["custom_product"]); ?> <img style="border: 1px solid;" src="../productImages/test0.png" /> <img style="border: 1px solid;" src="../productImages/test1.png" /> <img style="border: 1px solid;" src="../productImages/test2.png" /> <img style="border: 1px solid;" src="../productImages/custom.png" /> <!-- <img style="border: 1px solid;" src="../productImages/DSC03507_1455707404.png" /> -->