Quite often I was in need a function to scale an image to the size right to fit into bounding box.

For example, displaying images of real estate or product image in the shop site. Images can be different sizes, less or bigger of target size, portrait or landscape, etc..

I wrote little helper function in PHP that does that tasks using two modes: FIT and FILL. It uses standard PHP-GD extension.

Continue reading

HTML5 slowly releases all its beauty. Before HTML5 one thing which was almost completly out of our control was  the browser history manipulation without full page reload (location.hash hacks are not counted here). With appearence of HTML5 History API all things changed, now it is possible to add elements to the history, add navigation handlers and more.  This time I am going to dive into HTML5 History API.

Continue reading

When your brand new application looks shinny, it is time to put it on the Internet, process called deployment. Usually this involves several steps, like uploading application files, creating remote database, setting up configuration, etc.. Once it is setup and running you reazlise that your app is missing features X, Y and Z and deployment starts over and over again, this often leads to strange bugs.

I use simple lftp command line tool to automate project deployment via FTP and eliminate any possible deployment errors.

Continue reading

Nevertheless Amazon recent downtime showed us that clouds are not panacea for all problems, they are the future. Especially when quick scale, precise resource allocation is needed.

This book is about  applying your PHP skills in a clouds.

Most developers gloss over when they hear “the cloud” as the term has been appropriated by marketing types and has very little true meaning anymore. In this book, Vito and Ivo strip bare the buzzwords and help PHP developers figure out what the cloud is actually about and how they can take advantage of what cloud computing has to offer. After reading this book, you will not only have a clear picture of what cloud computing is, but you’ll also be able to utilize the various cloud services that are out there.

Continue reading

This is an update to my post “Google Apps Premier federated login with PHP“. Idea is simple, users do not like passwords, less passwords – less pain and more security.

Nowadays many companies have gone cloud, which covers most needs, but leaves space for homegrown small applications, ideas, prototypes, etc. It is convenient to organize user login into these applications using already existing Google Apps login infrastructure.

This is about using it with PHP.

Continue reading

Sometime ago I saw some framework where all files missed PHP closing tags, I wondered why ? Simply, this tag is not required by PHP parser, interesting when this was introduced. But one advantage of this is elimination of hunting down final carriage return character in the end file. This additional CR mess up the output when including.

In projects with 200+ code files, one simple return at the end of file can cause bugs hard to find.

Continue reading