April 2012

HTTP POST to a REST Service through PHP

Representational state transfer (REST) is a style of software architecture for distributed systems such as the World Wide Web. The term representational state transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation.

Resize Image and Maintain Aspect Ratio with jQuery

// IMAGE MANIPULATION and MAINTAIN ASPECT RATIO
function resizeImageWithAspectRatio(img) {
	var maxWidth = 250; // Max width for the image
	var maxHeight = 75;    // Max height for the image
	var ratio = 0;  // Used for aspect ratio
	var width = img.width();    // Current image width
	var height = img.height();  // Current image height
 
	// Check if the current width is larger than the max
	if(width > maxWidth){
		ratio = maxWidth / width;   // get ratio for scaling image
		img.css("width", maxWidth); // Set new width
		img.css("height", height * ratio);  // Scale h