EVOLUTION-NINJA
Edit File: certificate_page.php
<!DOCTYPE html> <html lang="en"> <head> <!-- Google Fonts with Italic Style --> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Certificate </title> <style> @import url('https://fonts.googleapis.com/css2?family=Cormorant+Upright:wght@300;400;500;600;700&family=Courgette&family=Lobster&family=Playwrite+IN:wght@100..400&family=Pochaevsk&display=swap'); /* Apply Google Font Italic */ .italic-text { font-family: "Cormorant Upright", serif; font-weight: 400; font-style: normal; } /* Exclude Italic for Important Fields */ .name, .details span, .footer span { font-style: normal; } body { margin: 0; padding: 0; background-color: #f5f5f5; display: flex; justify-content: center; align-items: center; height: 100vh; font-family: "Pochaevsk", serif; } .certificate { width: 210mm; height: 274mm; padding: 20px; margin: 0; box-sizing: border-box; position: relative; text-align: center; background-image: url('public/assets/images/Backup_of_New\ Design\ Certificate_2025.png'); background-repeat: no-repeat; background-size: 100% 100%; background-position: 0 0; background-color: white; } .logo { width: 250px; margin: 20px auto 30px auto; display: block; } .photo-container { width: 120px; height: 150px; margin: 20px auto; padding: 5px; display: block; border: 1px solid black; } .photo-container img { width: 100%; height: 100%; object-fit: cover; } /* Text Styles */ h2 { font-size: 24px; font-weight: 400; margin-bottom: 10px; } .name { font-size: 30px; font-weight: bold; margin-bottom: 15px; width: 50%; margin: 0 auto; padding-bottom: 5px; position: relative; top: 20px; } .details { font-size: 24px; line-height: 2.6; margin-bottom: 100px; } .details span { border-bottom: 1px dotted black; display: inline-block; width: 180px; text-align: center; padding-bottom: 5px; height: 46px; cursor: text; font-family: serif; font-weight: 800; } .grade { font-size: 22px; font-weight: bold; color: #228B22; margin-top: -74px; text-align: left; margin-left: 30px; } .footer { font-size: 24px; color: #555; margin-top: 40px; /* display: flex; */ justify-content: space-between; align-items: center; width: 100%; } .footer div { flex: 1; } .footer span { border-bottom: 1px dotted black; display: inline-block; width: 170px; text-align: center; padding-bottom: 5px; height: 20px; font-weight: bold; cursor: text; font-size: 14px; } .head-learning { font-size: 19px; font-weight: bold; text-align: right; margin-right: 32px; position: relative; bottom: 18px; } .print-btn { margin-top: 20px; padding: 10px 20px; font-size: 18px; background-color: #007BFF; color: #fff; border: none; border-radius: 5px; cursor: pointer; } .print-btn:hover { background-color: #0056b3; } .grade span{ border-bottom: 1px dotted black; width: 100px; display: inline-block; text-align: center; color: black; } /* Hide Choose File Button in Print Mode */ @media print { .print-btn, #photo-upload { display: none; } body { margin: 0; padding: 0; background-color: #fff; } .certificate { margin: 0; box-shadow: none; } } </style> </head> <body> <div class="certificate"> <!-- Logo --> <img src="<?php echo base_url('public/assets/images/Gtrac-Logo.png') ?>" alt="Logo" class="logo" style="opacity: 100%;"> <!-- Photo Upload --> <div class="photo-container"> <img id="uploaded-photo" src="<?php echo base_url('public/assets/studentimages' . htmlspecialchars($data->profile_image));?>" alt="Photo" > </div> <input type="file" id="photo-upload" accept="image/*" onchange="previewImage(event)"> <!-- Certificate Details --> <h2 class="italic-text">This Certificate is Awarded To</h2> <div class="name editable" contenteditable="true" style="color: black;"><?php echo htmlspecialchars($data->first_name); ?></div> <p class="details italic-text"> On the <span class="editable" contenteditable="true" style="font-family: 'Times New Roman', Times, serif; font-weight: 800;" id="date-day"><?php $day = date('d', strtotime($data->date)); $lastDigit = (int) substr($day, -1); $secondLastDigit = (int) substr($day, -2, 1); if ($secondLastDigit == 1) { // Handles 11th, 12th, 13th $suffix = 'th'; } elseif ($lastDigit == 1) { $suffix = 'st'; } elseif ($lastDigit == 2) { $suffix = 'nd'; } elseif ($lastDigit == 3) { $suffix = 'rd'; } else { $suffix = 'th'; } echo htmlspecialchars($day) . '<sup>' . $suffix . '</sup>'; ?> </span> day of the <span class="editable" contenteditable="true" style="font-family: 'Times New Roman', Times, serif; font-weight: 800;"><?php echo htmlspecialchars(date('F ', strtotime($data->date))); ?></span> month <br> in the year <span class="editable" contenteditable="true" style="font-family: 'Times New Roman', Times, serif; font-weight: 800;"><?php echo htmlspecialchars(date('Y', strtotime($data->date))); ?></span>, for successfully completing <br>the training of <span class="editable" contenteditable="true" style="width: 431px;" style="font-family: serif; font-weight: 600;"><?php echo htmlspecialchars($data->value_name); ?></span>. </p> <div class="grade">Grade: <span class="editable" contenteditable="true"><q>A</q></span></div> <!-- Footer --> <div class="footer"> <div style="width: 538px; text-align: left; margin-left: 29px; font-style: italic;"> CANDIDATE ID: <span class="editable" contenteditable="true"><?php echo htmlspecialchars($data->admission_no); ?></span> <br> DURATION DATE: <span class="editable" contenteditable="true"><?php echo htmlspecialchars(date('M d', strtotime($data->date)));?> to <?php echo htmlspecialchars(date(' M d Y', strtotime($data->date)));?></span> </div> <div class="head-learning"> Head - Learning Services </div> </div> <div style="justify-content: center;"> <p style="font-size: 24px; width: 80%; border-radius: 50px; background-color:#97B33A; display: inline-block;" >Visit our website : www.mygtrac.com</p> </div> <p style="font-size: 19px; margin-top:-2px">#656/D,16th Main, 5th Cross, Saraswathipuram, Mysuru, - 570009, Karnataka,<br> <b>M:</b> +91 9591343563 / <b>P: </b>0821 - 4250222 / <b> E: </b> infomytrac@gmail.com </p></div> <!-- Print Button --> <button class="print-btn" onclick="window.print()">Print Certificate</button> <script> function previewImage(event) { var reader = new FileReader(); reader.onload = function() { var output = document.getElementById('uploaded-photo'); output.src = reader.result; }; reader.readAsDataURL(event.target.files[0]); } </script> <script> document.getElementById("date-day").addEventListener("input", function() { let day = this.innerText.replace(/\D/g, ''); // Remove non-numeric characters let lastDigit = parseInt(day.slice(-1)); let secondLastDigit = parseInt(day.slice(-2, -1)); let suffix = "th"; if (secondLastDigit !== 1) { // Special case for 11th, 12th, 13th if (lastDigit === 1) suffix = "st"; else if (lastDigit === 2) suffix = "nd"; else if (lastDigit === 3) suffix = "rd"; } this.innerHTML = day + "<sup>" + suffix + "</sup>"; }); </script> </body> </html>