Monday, December 13th, 2010
Have you ever needed one image in many different sizes on a website? I know I have many times and have never found a good way to handle this until now!
In the CMS’ you build do you have the user upload different sizes of images? Maybe a large image, and a thumbnail. Wouldn’t it be so much nicer if you could have them upload the large image, and then you use whatever sizes of that image you need? Here is how:
This smart image resize technique is really handy in that there is only ONE file you need to worry about.
This is a breakdown of how it is used:
<img src="/image.php/image.jpg?width=200&height=200&image=/full/path/to/image.jpg" alt="" />
The above code will use the “width” and “height” parameters as the max the image should contain. So the image might be 200px wide but only be 150px tall in order to keep the original ratio.
Now if we wanted to crop our image into a square no matter what the ratio is we would add on another parameter called “cropratio” as follows:
<img src="/image.php/image.jpg?width=200&height=200&image=/full/path/to/image.jpg&cropratio=1:1" alt="" />
*** Please note that the image parameter (/full/path/to/image.jpg) must be the full path from the document root to the image.
If you are having problems check out the shifting pixel’s page.
Wednesday, August 4th, 2010
In this tutorial we are going to create sleek calendar using php with a good looking UI and a navigation. Let’s get started !!
First of all create the project folder on your server and inside it create a php file.
Tuesday, December 29th, 2009
So you want to learn about MVC? This article will hopefully clear some of your possible confusion when it comes to this three letter acronym that can strike fear into the hearts of many. Like most topics in web development, it’s always a little confusing when you first take a look at it, but after you read up on the topic, and try it for the first time, it’s as easy as pie! Read on, my friend!
MVC stands for Model-View-Controller. It is an architectural pattern used when engineering software. Basically, it separates the three main parts of an application and makes them independent of each other, therefore they can be designed, tested, and worked on independently of each other.
In the world of web development, MVC is usually used with a framework such as CakePHP or CodeIgniter. For the purposes of this post, we won’t be focusing on any individual framework, more on the idea of what MVC really is and how it can be used. If you would like to delve into one framework as a beginner, though, I highly recommend CodeIgniter to get started. It is simple, yet powerful, and won’t confuse you when you’re getting started.
Models are very simple. They are the knowledge of your program, they represent it as either a single object, or a structure of multiple objects.
In the static web world, your model could be simply the HTML of your page. It is the skeleton of your content, how it will be structured, and of course, the content itself.
The view is a visual representation of a model. In a program, a view fetches the model’s data, and displays it. It can also update the model by collecting data.
A static example of this is plain old CSS. The CSS adds visual style to your model (the HTML), it is used as the “skin” to the skeleton of your content. We can switch from one style to another and not affect the model at all.
The controller is what puts it all together between the user and the system. It receives user’s input in the form of commands and data, then outputs the views that are to be presented.
An example of the Controller would be the browser. It takes the HTML, CSS and any other jargon and outputs a readable web page for the user to interact with. It can also accept user input in a sign up form for example.
Hopefully I haven’t confused you too badly, and you have at least a basic understanding of MVC now. It’s literally all around you, as I have shown in a simple HTML/CSS/Browser example. If you want to read more, the CodeIgniter documentation explains it in terms of their own framework. Take a look at those docs here. Thanks for reading!
Wednesday, December 2nd, 2009
In this tutorial we are going to implement paging using php and jquery. We are going to create a paging widget and we will give it a cool UI using jquery UI. I have tried to explain paging in the most simplest way and it can be extended further easily to more advance form of paging.
Monday, November 30th, 2009
Hello and welcome to my first article for the Brenelz Web Solutions blog! This article will cover how you can create a very simple API for any one of your projects. We are going to be using PHP and MySQL for the back end, and we will output our API data in two formats: XML or JSON.