Today, i have written a script named “Dynamic ID card generator” for one of my php project. The output of this script is an image id card from given input values. Customers/Users need to save it to their desktop and then they can print it .
If you are planning to provide id card to your website users and if your site is running on php (version > 4.1) platform and have GD enabled, then this script for you. You can easily customize font color, font type, card theme, image border color etc. from configuration file.
As this script created very urgently so bugs are not unexpected and I beg pardon for this. The drawback of this script, I think image/text placing is very straight forward. I believe it can be more dynamic. If I get time in future I will do it but you guys can give a more professional look.
download “id card generator“
Inputs: = array();
You need to pass a two dimensional array to constructor.
Output: = image;

For the above image output, code given below:
(please do not change array keys except $params['card_holder']['details'][])
<?php
define("_SLG_", 1);
// including configurable variables file
require_once("constants.php");
// including image processing class
require_once("libs/Class.ImageProcessing.php");
// including id generator class
require_once("libs/Class.GenerateIdCard.php");
// declaring empty array
$params = array();
// card holder's ID
$params['card_holder']['id'] = 'p1254edce';
// card holder's name
$params['card_holder']['name'] = 'Muhammed Imran Hussain';
// card holder's image name. This image must be locate in script images directory
$params['card_holder']['image'] = 'customer.jpg';
// card holder's basic info. Maximum 3 elements.
// Array keys will be title and value will be field value
$params['card_holder']['details'] = array(
'DOB'=>'23/10/1985',
'City'=>'Dhaka',
'Nationality'=>'Bangladeshi'
);
// card issue date
$params['card_holder']['issue_date'] = "10/25/2008";
// card expire date
$params['card_holder']['expire_date'] = "10/25/2010";
/*-------------------------------------------------*/
/*------------ Card provider's title text ---------*/
/*-------------------------------------------------*/
$params['card_provider']['card_provider_title_text'] = "beta version 2.0";
/*---- creating GenerateIdCard class object -----------*/
$objCard = new GenerateIdCard($params);
/*---- giving output -----------*/
$objCard->ImageOutput();
?>
Thanks all.
Recent Comments