This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 15k traffic Daily!!!

Create dynamic certificates in PHP


We’ll use the PHP GD Library or extension which is able to present us the features to govern our photos dynamically.



Makes use of of PHP GD Library:

  • To create dynamic certificates
  • Create dynamic captcha
  • Creating dynamic charts
  • Creating dynamic Studies
  • We are able to create the watermarks on our photos
  • We are able to resize the pictures, enhance or lower the standard of photos, change picture mime kind or extension
  • Optimize or Compress Pictures

Right here we are going to create a dynamic certificates in PHP by utilizing PHP GD Library.

To start with we’ve got to test is PHP GD Extension is enabled or not. Use the code under and test is gd enabled.

<?php

/*Checking the PHP GD Extension Enabled or Not*/

phpinfo();

Enter fullscreen mode

Exit fullscreen mode

PHP Info

Now we are going to create the certificates dynamically by utilizing php gd library.

/*Utilizing PHP GD Library to course of photos and creating dynamic certificates, captcha, experiences and so forth.*/

/*Creating Certificates Dynamically*/

//Set the Content material Kind
header('Content material-type: picture/jpeg');

// Create Picture From Current File
$jpg_image = imagecreatefromjpeg('certificates.jpg');

// Allocate A Colour For The Textual content
$white = imagecolorallocate($jpg_image, 54, 12, 110);

// Set Path to Font File
$font_path = 'font.ttf';

$name_text = "Chetan Rohilla";

$date_text = date('jS F,Y');

$signature = imagecreatefrompng('signature.png');

imagettftext($jpg_image, 26, 0, 480, 400, $white, $font_path, $name_text);

imagettftext($jpg_image, 20, 0, 220, 670, $white, $font_path, $date_text);

/*signature on picture*/
imagecopy($jpg_image, $signature, 780, 620, 0, 0, 200, 58);
/*signature on picture*/

// Ship Picture to Browser
imagejpeg($jpg_image);

// Clear Reminiscence
imagedestroy($jpg_image);
Enter fullscreen mode

Exit fullscreen mode

After including this code, it’s important to add certificates.jpg file, signature.png file and font.ttf file within the folder the place your php file is situated.

Obtain font.ttf

That’s it Now you may create dynamic certificates in php, watermarks in php, captcha in php, charts in php or course of photos in php.


Please like share subscribe and provides optimistic suggestions to inspire me to jot down extra for you.

For extra tutorials please visit my website.

Thanks:)
Completely satisfied Coding:)

The Article was Inspired from tech community site.
Contact us if this is inspired from your article and we will give you credit for it for serving the community.

This Banner is For Sale !!
Get your ad here for a week in 20$ only and get upto 10k Tech related traffic daily !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to Contribute to us or want to have 15k+ Audience read your Article ? Or Just want to make a strong Backlink?