Archive for category PHP

Coming Soon - Premium WordPress Theme Giveaway To All Our Email Subscribers

Tutorial on dynamically creating PDF file in websites using PHP

There are many circumstances we come across where we need to create PDF files in our websites dynamically(like creating a PDF file from fetching data from a MySQL database or an external text file).But many don’t have any idea on how to create such PDF files, so I thought it will be a great idea to do a tutorial on this since there aren’t many tutorials on this topic on the web.

When it comes to creating dynamic PDF files in websites, there are two PHP classes available, They are

  • TCPDF
  • FPDF
Both of them are free and easy to use and below is their description from the official website.

create PDF files in our websites dynamically(like creating a PDF file from fetching data from a MySQL database or an external text file)

What is TCPDF ?

TCPDF is a FLOSS PHP class for generating PDF documents.Started in 2002, TCPDF is now one of the world’s most active Open Source projects, used daily by millions of users and included in thousands of CMS and Web applications.You can generate PDF files for almost any application using TCPDF.

What is FPDF ?

FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.FPDF requires no extension (except zlib to activate compression and GD for GIF support). It works with PHP 4 and PHP 5 (the latest version requires at least PHP 4.3.10).
But due to rich documentation, vast number of examples and an active support forum I prefer TCPDF and I am going to take TCPDF as a base for this tutorial.
Here are a list of some of the features of TCPDF:
  • no external libraries are required for the basic functions;Create PDF files from data from SQL database using TCPDF
  • all standard page formats, custom page formats, custom margins and units of measure;
  • UTF-8 Unicode and Right-To-Left languages;
  • TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
  • font subsetting;
  • methods to publish some XHTML + CSS code, JavaScript and Forms;
  • images, graphic (geometric figures) and transformation methods;
  • supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http: www.imagemagick.org/www/formats.html)
  • 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index – Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, QR-Code, PDF417;
  • Grayscale, RGB, CMYK, Spot Colors and Transparencies;
  • automatic page header and footer management;
  • document encryption up to 256 bit and digital signature certifications;
  • transactions to UNDO commands;
  • PDF annotations, including links, text and file attachments;
  • text rendering modes (fill, stroke and clipping);
  • multiple columns mode;
  • no-write page regions;
  • bookmarks and table of content;
  • text hyphenation;
  • text stretching and spacing (tracking/kerning);
  • automatic page break, line break and text alignments including justification;
  • automatic page numbering and page groups;
  • move and delete pages;
  • page compression (requires php-zlib extension);
  • XOBject templates;
Dynamically Creating TCPDF files in websites using TCPDF

Dynamically Creating TCPDF files in websites using TCPDF

There are 64 examples and there is no way I can explain the source code of each and every example from the official website, but the code is heavily commented enriched with detailed documentation and an active support forum at Sourceforge will really help you out to customize the code for your own needs.
So go ahead, take a look at the live demo, Download Source code and take a look at the documentation.

Click to Download Source Code of creating dynamic PDF files in website

Download

Click to view Live Demo of creating dynamic PDF files in website

Live Demo

Click here to documentation of creating dynamic PDF files in website

Documentation

Click here to go to Support Forum for dynamically creating PDF files in website

Support Forum

The live demo is hosted on our website and has been presented in a friendly layout which would easily let you understand how the code works.
If you need any support regarding this tutorial, then please leave your comment below and we will definitely respond to your question with a suitable solution.

TCPDF PHP class can be used to create almost any type of PDF file for all your purposes, but sometimes it is slight tricky to customize the script for our needs, if you ever run against any obstacles then please let us know and we will definitely help you.

Next week we will back with another unique and interesting tutorial in the meanwhile stay updated with all the tutorials at Geo Web Station by :

If you have any problems using the downloaded files, then leave a comment below.

Want more improvisations on this script ?, or want to request a new tutorial, then please Contact me right-away.

I promise to respond to everyone who contacts asking for support or new tutorials.

VN:F [1.9.22_1171]
Rating: 3.7/5 (3 votes cast)

, , , , , , , , , , , , , , , , , , ,

3 Comments

Creating a stylish HTML5 & AJAX Contact Form

It has taken more time than I expected to complete this tutorial, because I kept on adding more and more features to our contact form.

Starting with the idea of just a simple HTML5 contact form, later thought of adding AJAX form submission and later came the idea of supporting JavaScript disabled browsers and much more.

ultimate contact form which can be seamlessly integrated to any website and works totally fine in any browser providing a cool user interface.

What is HTML5 ? Can we use it in our project ?

HTML5 is the next generation of HTML.

HTML5 supports all the form controls from HTML 4, but it also includes new input controls. Some of these are long-overdue additions like sliders ,date pickers and color pickers; others are more subtle.

For example, the email input type looks just like a text box, but mobile browsers will customize their onscreen keyboard to make it easier to type email addresses. Older browsers that don’t support the email input type will treat it as a regular text field, and the form still works with no markup changes or scripting hacks. This means we can create a more improved Forms for our website, even if some of our visitors are stuck on IE 6.

In our contact form we are going to use input controls namely email ,required, url and phone. Yeah That’s it, but its good enough to make a really good contact form.

What is AJAX ?

AJAX can create a highly responsive web interface and increase the user experience.Using AJAX the form can be submitted without Page reload which makes our form much more friendly.

Browser Support

The CSS styling has been coded in such a way that the page looks exactly same in all popular web browsers.Although the form uses AJAX form submission, if JavaScript has been disabled in a web browser then a normal contact form will be rendered.

To sum up this is an ultimate contact form which can be seamlessly integrated to any web

Creating Stylish HTML5 and AJAX Contact Form tutorial

site and works totally fine in any browser providing a cool user interface.

Including the code on this page would make the very post very long, so please download the source code and refer to it.The code has been heavily commented and would pose no difficulty to use it in your website.

Installation Instructions

After downloading the Source code, open config.phpin a text editor and enter your email address

<?php
$to = "your_email_address";//enter your email address
?>

Click to Download Source Code of stylish HTML5 ans AJAX contact form

Download

Click to view Live Demo of stylish HTML5 and AJAX contact form

Live Demo

Next tutorial will be back with an interesting tutorial, meanwhile keep updated with all our tutorials by :

If you have any problems using the downloaded files, then leave a comment below.

Want more improvisations on this script, or want to request a new tutorial, then please Contact me right-away.

I promise to respond to everyone who contacts asking for support or new tutorials.

VN:F [1.9.22_1171]
Rating: 5.0/5 (4 votes cast)

, , , , , , , , , , , , , , , , , , , , , ,

2 Comments

Top 10 Most Popular File Upload Scripts – Live Demo and Free Download(Part 2)

This is the second part of my article on Top 10 Most Popular File Upload Scripts. This post contains the bottom five of the top ten file upload scripts in the list, If you haven’t read the first part of this post then I recommend going through it first here.In my previous post I had listed file upload scripts which had multiple functionality which can be easily customized for your needs, But in this tutorial I have listed file upload scripts which are similar in features and look of those found in popular websites like Gmail, Google Plus, Flickr and Facebook.

So enjoy this Five upload scripts by having a look at the live demo or downloading the live demo and implementing the script in your own website:


6.jQuery File Upload


Review

Although this script has no similarity to those found on any website, still it has made to the list because it has some very great features without using flash.Features like multiple file select, automatic upload, thumbnail, upload cancel, file delete makes this upload script a very good script for all purposes

Description from official website

No description found

Features

Features
Multiple file upload:
Allows to select multiple files at once and upload them simultaneously.
Drag & Drop support:
Allows to upload files by dragging them from your desktop or file manager and dropping them on your browser window.
Upload progress bar:
Shows a progress bar indicating the upload progress for individual files and for all uploads combined.
Cancelable uploads:
Individual file uploads can be canceled to stop the upload progress.
Resumable uploads:
Aborted uploads can be resumed with browsers supporting the Blob API.
Chunked uploads:
Large files can be uploaded in smaller chunks with browsers supporting the Blob API.
Preview images:
A preview of image files can be displayed before uploading with browsers supporting the required HTML5 APIs.
No browser plugins (e.g. Adobe Flash) required:
The implementation is based on open standards like HTML5 and JavaScript and requires no additional browser plugins.
Graceful fallback for legacy browsers:
Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
Standard HTML file upload form:
Shows a standard HTML file upload form if JavaScript is disabled.
Cross-site file uploads:
Supports uploading files to a different domain with Cross-site XMLHttpRequests.
Multiple plugin instances:
Allows to use multiple plugin instances on the same webpage.
Customizable and extensible:
Provides an API to set individual options and define callBack methods for various upload events.
Multipart and file contents stream uploads:
Files can be uploaded as standard “multipart/form-data” or file contents stream (HTTP PUT file upload).
Compatible with any server-side application platform:
Works with Google App Engine (Python, Java), Ruby on Rails, PHP and any other platform that supports HTTP file uploads.

Pros and Cons

ADVANTAGES DISADVANTAGES
No browser plugins (e.g. Adobe Flash) required: Requires JavaScript to be enabled or else shows a standard html4 upload element.
Uploads files via XMLHttpRequests if supported and uses iframes as fallback for legacy browsers.
Supports uploading files to a different domain with Cross-site XMLHttpRequests.

Live Demo and Download

Click here to Download Source Code of jQuery File Upload

Download

Click to view Live Demo jQuery File Upload

Live Demo


7.Flickr File Upload


Review

This is the exact replica of the File uploader in Flickr

Description from official website

No description found

Features

Features
All the features similar to the file upload system on Flickr, Click here to check the actual Flickr file upload

Pros and Cons

ADVANTAGES DISADVANTAGES
Nice upload script for video or photo galleries Uses Flash
A well suited script for uploading photos or videos Uploading cannot be cancelled once upload button is pressed

Live Demo and Download

Important Note

After downloading the files Please do the following changes in order for the script to workModify the index_files/config.js file line no 49

var AdnanTotal = 0;
var _site_root = 'your script location';
var upload_Path = _site_root + '/upload.php'

Click here to Download Source Code of Flickr File Upload

Download

Click to view Live Demo Flickr File Upload

Live Demo


8.Uber-Uploader


Review

Although looks like an outdated script with no updates for newer features like html5, It is still a very good script with all those features without using flash.It is written in Perl, PHP and JavaScript.

Description from official website

Uber-Uploader is a group of programs written in Perl, PHP and JavaScript. It is intended to present a graphical representation of the status of a web-based file upload in the form of a progress bar.

Features

Features
Progress bar
Delete selected files
Different modes of progress bars
Does not use browser plugins like flash
Email support:
Emails whenever a file is uploaded

Pros and Cons

ADVANTAGES DISADVANTAGES
No browser plugins (e.g. Adobe Flash) required: Uses perl and is a bit outdated.
Progress bar  Difficult to set up for newbies
Email support:
Emails whenever a file is uploaded
 lack of support

Live Demo and Download

Click here to Download Source Code of Uber-Uploader

Download

Click to view Live Demo Uber-Uploader

Live Demo

Click here to go to next page >>

VN:F [1.9.22_1171]
Rating: 5.0/5 (4 votes cast)

, , , , , , , , , , , , , , , , , , , , ,

4 Comments

Top 10 Most Popular File Upload Scripts – Live Demo and Free Download(Part 1)


A File upload script is essential for every website and there are a plenty of such ready file upload scripts available on the web, but with their own pros and cons, So I thought that It would be a great idea creating a post on the  top ten file upload scripts ever and would serve as a very useful resource for all webmasters.For every script I have listed their advantages and disadvantages, so it would be easy for you to choose the right one. Below is my list of  top ten File upload Scripts :

Since I want to give a detailed review about all the ten scripts i will be only revealing the top five Upload scripts in this post and in my next post I will be revealing the next five upload scripts


1.Plupload


Review

For those who know some of these scripts might be wondering how Plupload came on the first position in the list rather than SWFupload.What really brings Plupload to the top of this list is its support for HTML5 Gears, Silverlight, Flash, BrowserPlus. If the user’s browser doesn’t support any of these then a normal HTML4  file upload is implemented moreover it-seems to be very stable.

Description from official website

Allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms, providing some unique features such as upload progress, image resizing and chunked uploads.Plupload is a highly usable upload handler for your Content Management Systems or similar. Plupload is currently separated into a Core API and a jQuery upload queue widget this enables you to either use it out of the box or write your own custom implementation.

Features

Feature Flash Gears HTML 5 Silverlight BrowserPlus HTML 4
Chunking
Drag/Drop *
PNG Resize *
JPEG Resize
Type filtering  *
Stream upload
Multipart upload  *
File size restriction
Upload progress

Pros and Cons

ADVANTAGES DISADVANTAGES
Upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms Lack of support, Forum is not very active
unique features such as upload progress, image resizing and chunked uploads.
Highly usable and stable upload handler with custom implementation

Live Demo and Download

Download Source Code of Plupload

Download

Click to view Live Demo of Plupload

Live Demo


2.SWFUpload


Review

SWFUpload logo

SWFUpload uses both JavaScript and Flash library to provide a great upload experience.It is exactly similar to the attachment uploading Gmail which is very popular.It is a great upload script with almost every feature we want except for one main disadvantage that it uses Flash library.

Description from official website

SWFUpload is a small JavaScript/Flash library to get the best of both worlds. It features the great upload capabilities of Flash and the accessibility and ease of HTML/CSS.

Features

Features
Upload multiple files at once by ctrl/shift-selecting in dialog
Javascript callbacks on all events
Get file information before upload starts
Style upload elements with XHTML and css
Display information while files are uploading using HTML
No page reloads necessary
Works on all platforms/browsers that has Flash support.
Degrades gracefully to normal HTML upload form if Flash or JavaScript is unavailable
Control filesize before upload starts
Only display chosen file types in dialog
Queue uploads, remove/add files before starting upload

Pros and Cons

ADVANTAGES DISADVANTAGES
Upload multiple files at once and JavaScript callbacks Requires Flash and does not work in browsers with flash not been installed
Exactly similar to Plupload Customization becomes difficult without proper knowledge of javascript
Unlike Plupload, the forums are very active.

Live Demo and Download

Download Source Code of SWFUpload

Download

Click to view Live Demo of SWFUpload

Live Demo

Go to next page >>

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)

, , , , , , , , , , , , , , , , ,

2 Comments

Facebook like jQuery face recognition tutorial and demo

Facebook influences our life each and everyday. One of the features which has contributed enormously to make Facebook appealing to even to its average users is Photos.

Facebook like jQuery Face detection in photosWhenever we upload photos to Facebook, Facebook automatically recognizes the faces in the photo and allow you to tag them.
If you ever wondered how to detect faces in photos in your own website, then the answer is very simple, Faces in photos  can be easily detected using a jQuery plugin.

In this tutorial i will show you how to detect faces in a photo.

Face recognition

Below you can download the Source Code, or have a look at the Live Demo

Download Source Code

DOWNLOAD

Live Demo

LIVE DEMO

Important Note
Many users have complained that the Live Demo does not work in Internet Explorer, So I recommend using any other updated versions of the browser like Safari, Mozilla Firefox, Google chrome(Best) or Opera for maximum impact.

For this tutorial we are going to use FaceDetection jQuery plugin which uses an algorithm by Liu Liu

This is what the download file and the live demo contains

  • In the first example you can see the face detection plugin applied to photos on the server
  • In the second example you can upload an image file of your choice and detect faces in the photo you upload.


Something that can let you improve this tutorial is enabling photo tagging after face recognition ( that is exactly what Facebook does), right now this tutorial only shows face recognition, in coming tutorials I will try to show photo tagging as well


Below is the PHP code of the file index.php


Important Note
The following code is just the simplest example as to how to use the plugin, the source code available for download has many more examples and scenarios at which face detection can be used,hence I strongly advise you to download the source code and also have a look at the Live demo.
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Facebook like jQuery face recognition demo| Files on server 1 | http://blog.geotitles.com</title>
	<link rel="stylesheet" type="text/css" href="../../css/styles.css"/>
	<script src="http://code.jquery.com/jquery-1.5.1.min.js"></script>
	<script src="../../js/facedetection/ccv.js"></script>
	<script src="../../js/facedetection/face.js"></script>
	<script src="../../js/jquery.facedetection.js"></script>
	<script>
	$(function() {
		$('#try').click(function() {

			var $this = $(this);

			var coords = $('img').faceDetection({
				complete:function() {
					$this.text('Done!');

				},
				error:function(img, code, message) {
					$this.text('error!');

					alert('Error: '+message);

				}
			});
			for (var i = 0; i < coords.length; i++) {
				$('<div>', {
					'class':'face',
					'css': {
						'position':	'absolute',
						'left':		coords[i].positionX +'px',
						'top':		coords[i].positionY +'px',
						'width': 	coords[i].width		+'px',
						'height': 	coords[i].height	+'px'
					}
				})
				.appendTo('#content');
			}
		});
		return false;
	});
	</script>
	<style>
		.face {
			border:2px solid #FFF;
		}
	</style>
</head>

<body>
<div id="container">
  <div id="header">
		<h3>These are the demos of<a href="http://blog.geotitles.com/2011/08/facebook-like-face-detect/"> Facebook like face detection tutorial</a> at GEO WEB STATION Click <a href="http://blog.geotitles.com/2011/08/facebook-like-face-detect/">here</a> to go back to the <a href="http://blog.geotitles.com/2011/08/facebook-like-face-detect/">tutorial</a> to download the demo files</h3>

  </div>

	<div id="content">

		<a href="#" id="try">Detect Faces</a>

		<img src="../../images/faces.jpg" />

	</div>
</div>
</body>
</html>

After downloading the source files open the readme file for installation instructions

Next week watch out for another interesting tutorial.

Stay updated with our blog by

If you have any problems using the downloaded files, then leave a comment below.

Want more improvisations on this script, or want to request a new tutorial, then please Contact me right-away.

I promise to respond to everyone who contacts asking for support or new tutorials.

VN:F [1.9.22_1171]
Rating: 5.0/5 (6 votes cast)

, , , , , , , , , , , , , , , , , , , , , , , , , , , ,

11 Comments