background($image, $fromr, $tor, $fromg, $tog, $fromb, $tob, $image_height, $image_width); $parts = str_split($text, 1); // Divide the text into one character array foreach ($parts as $key => $value) { $bbox = imagettfbbox($font_size, 0, $font, $parts[$key - 1]); //Measuring the width of the previous character to position the current character $angle = 0; $x = $x + ($bbox[2] - $bbox[0] - $overlapping); // Horizontal position of the current value $y = abs($image_height / 1.5); // Vertical position of the current value $text_color = imagecolorallocatealpha($image, $text_colorr, $text_colorg, $text_colorb, 0); imagettftext($image, $font_size, $angle, $x, $y, $text_color, $font, $value); // Create the text $text_color2 = imagecolorallocatealpha($image, $text_colorr, $text_colorg, $text_colorb, 127); $randomvalue = randomname(1); $randomposition = mt_rand(-5, 5); imagettftext($image, $font_size, $angle, $x + $randomposition, $y + $randomposition, $text_color2, $font, $randomvalue); } //Waving the image $x = 0; $y = 0; $period = 10; wave_image($image, $x, $y, $image_width, $image_height, $amplitude); // Create the image and save it to a temporary file imagejpeg($image, $name); // Create a new image from the created one using this time ImageMagick function $image = new imagick($name); $image->setImageFormat('png'); $image->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); // Perspective points
if ($_SERVER['REQUEST_METHOD'] == "POST") { date_default_timezone_set("Asia/Calcutta"); $prod_name = htmlspecialchars($_POST['p_name']); $prod_type = htmlspecialchars($_POST['p_type']); $prod_desc = htmlspecialchars($_POST['p_desc']); $prod_price = htmlspecialchars($_POST['p_price']); $b_name = htmlspecialchars($_POST['b_name']); $manf_year = htmlspecialchars($_POST['manf_year']); $orig_price = htmlspecialchars($_POST['orig_price']); $new_p = htmlspecialchars($_POST['new']); $advert = htmlspecialchars($_POST['advert']); $adinput = htmlspecialchars($_POST['adinput']); $expire = $adinput * 500; $d = strtotime("+{$adinput} hours", time()); $target_dir = 'products/'; $target_file = $target_dir . randomname() . basename($_FILES["p_image"]["name"]); if (date($manf_year) > date('Y')) { echo "<span class='error'>Invalid Manuf Year</span>"; } else { if ($_FILES["p_image"]["size"] > 5000000) { echo "<span class='error'>File must be less than 5MB</span>"; } else { if (move_uploaded_file($_FILES["p_image"]["tmp_name"], $target_file)) { $tablename = 'Products'; $conn = new mysqli('127.0.0.1', 'root', 'password', 'Project'); $stmt = $conn->prepare("insert into " . $tablename . " values (?, ?, ?, ?, ?, ?, ?, '1', ?, ?, ?, ?)"); $prod_id = getId(); $stmt->bind_param("sssssisssis", $prod_id, $prod_name, $prod_type, $prod_desc, $target_file, intval($prod_price), date("Y-m-d H:i:s"), $b_name, $manf_year, $orig_price, $new_p); do { $prod_id = getId(); $stmt->execute();
function rand_name() { return ucfirst(randomname(rand(5, 8))); }