This is fairly a straightforward topic. Just a few lines of PHP code will do the work of getting the client user IP address. Most of the times it is true, it is all about a few lines of PHP script.
Sometimes things get tricky. We shall see about those things and also an other aspect like the privacy issue involved with it.
Following one line PHP code will get you the client user’s IP address. Then why all the fuss? Read through the article and you will know about it.
$_SERVER is a PHP array which is set by the server. Depending on this one line PHP code may not yield the best results in many a situation. For example, if a client is behind a proxy server, then this variable will not be suitable. Also be aware that, these headers can be easily spoofed by the users by setting an IP address themselves. (more…)
Bootstrap is the most popular solution to design an optimum, intuitive, mobile-ready UI components. It is easy to integrate the Bootstrap library for the application interface.
Often, many of my readers ask for a Bootstrap contact form code. So I thought of creating a basic example for a Bootstrap enabled PHP contact form.
Bootstrap provides in-built features to take care of UI responsiveness, form validation, and more. I used its SVG icon library to display the contact form fields with suitable icons.
A Bootstrap contact form looks enriched. UI attracts people and enables them to use it with ease. Also, the developers’ effort is reduced by using the Bootstrap framework. (more…)
Photo editing effects will turn graphical elements to be expressive. With suitable effects, you can use a simple image and convey an idea. For example, you can bring logo to the foreground by blurring the background image.
The effects like image blur, transparency, shadowing creates attractive visual effects. There are many different image effects available. In fact, hundreds of them are available.
Online photo editing tools use a variety of methods to apply the effects on a target image. For example, either a CSS filter property or a SVG filter primitive can create an image blur effect.
Most of the visual effects are achievable with HTML5 and CSS3 filter properties. We will see how to make photo editing effects to blur, apply sepia, and vintage effect on a target image.
I created a simple image editing tool to apply blur, sepia, and vintage effect on a target image. Following is a live preview of the tool.
I have added a jQuery slider to allow you to fiddle with the image editing effects between a min-max range.
This example handles blur, sepia and vintage effect on an image element. (more…)
Constructor in PHP is special type of function of a class which is automatically executed as any object of that class is created or instantiated.
PHP – The __construct Function
PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used.
A class is a template for objects, and an object is an instance of class.
Object Oriented Concepts
Before we go in detail, lets define important terms related to Object Oriented Programming.
- Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.
- Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.
Object-Oriented programming is faster and easier to execute. From PHP5, you can also write PHP code in an object-oriented style.
PHP What is OOP?
OOP stands for Object-Oriented Programming.
A file explorer, specially designed for showcasing image files will be a cool addition to your PHP web application when you are handling images.
Imagine an image file explorer built in PHP with options to options to browse files in icon, list and detailed view. That is what we are going to see and build in this article.
Having feature to explore image files with different modes of display will enrich your web applications. Image gallery is a popular choice but if it comes added with other views, it will be a definite win for the users.
File-explore.js is a minimal jQuery folder tree/file explorer plugin used to convert nested unordered lists into a hierarchical tree that is both expandable and collapsible.
How to use it:
1. Add the jQuery file-explore plugin’s files to the webpage which has jQuery library loaded.
<link href="css/file-explore.css" rel="stylesheet"> <script src="//code.jquery.com/jquery.min.js"></script> <script src="js/file-explore.js"></script>
How to use it:
1. Load jQuery library and the jQuery explr-js plugin’s files in the html file
<link href="jquery-explr-VERSION.css" rel="stylesheet"> <script src="//code.jquery.com/jquery.min.js"></script> <script src="jquery-explr-VERSION.js"></script>