Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Three Devs & A Maybe:
Episode 66 - Easy Like Sunday Morning
Jun 01, 2015 @ 08:36:01

The Three Devs & A Maybe podcast has posted their latest episode, #66 - Easy Like a Sunday Morning, with hosts Michael Budd, Fraser Hart, Lewis Cains and Edd Mann.

This week on a early Sunday morning recording, we start off podcast discussion with A/B testing and Google Analytics/Experiments. We then move on to touch upon distributing PHP console applications within PHAR's, application security and Google's recent IO conference. Following this we bring up a couple of small projects Edd is currently working on, relating to Morse Code and Colour detection algorithms. Finally, we wrap up the show by discussing the current Space Beer Cave competition that is still underway, and how one contestant is running away with the prize at this time.

Other topics mentioned include Box PHP, Ghostery and the missing mcrypt extension. You can listen to this latest episode either through the in-page audio player or by downloading the mp3. If you enjoy the show, be sure to subscribe to their feed or over in iTunes to get the latest shows as they're released.

tagged: threedevsandamaybe podcast ep66 abtesting phar console googleio color

Link: http://threedevsandamaybe.com/easy-like-sunday-morning/

Wojciech Sznapka:
Export colored Behat scenarios to PDF
Sep 04, 2012 @ 09:42:49

Wojciech Sznapka has shares his technique for creating colorized exports of Behat tests for use in PDF files:

Behat scenarios are one of the best ways to describe system. UML Use Cases or tons of pages in SRS documents are fine, but hard to understand from the begining, and even harder to maintain in the future. Behat eases this process and also gives opportunity to automate requirements verification. To write Behat scenarios you need a text editor. I’ve picked my favourite – Vim, which highlights *.feature files syntax. But business people mostly don’t use Vim, so I need to figure a way, to expose scenarios in easy and pleasant way.

His solution involves setting up some printing options in vim to export the tests as a Postscript file, setting the "colorscheme" to the default setting so the colors will be retained. The result is exported (via the "hardcopy" command) and can be converted into a PDF (with a result like this).

tagged: behat test color export postscript pdf print

Link:

.Net Magazine:
Create an SVG data visualization with PHP
Sep 13, 2011 @ 12:13:25

On the .net magazine site (yes, really) there's a recent post from Brian Suda about creating SVG images with PHP thanks to the GD functionality that's included in every release.

If you’re working online, then canvas springs to mind. It allows you to draw raster graphics quickly and easily. If you want, there are also plenty of image code libraries that can generate GIFs, JPEGs and PNGs on request. But what if your target isn't always online? What if you’re aiming for print? Then you could use a raster graphic, but it would need to be pretty large. A better solution is to create a vector-based image format from your code. This is where SVG (Scalable Vector Graphics) steps in.

He starts by explaining a bit about SVG and what it is for those that haven't worked with it before. He givesn an example of a poster from Wired showing circles with colors from their covers over the last 15 years. He shows how to do something similar with images of the .net magazine covers, pulling out the color frequency with the imagecolorat function. Toss in a bit of markup and some formatting of the color output and you'll get circles with concentric rings with the most prominent colors ending up the largest. You can see his result here.

tagged: svg tutorial gd image color frequency

Link:

Sameer Borate's Blog:
Generating a color palette from a image in php
Jun 21, 2011 @ 13:09:38

Sameer Borate has posted a simple method for creating a color palette from a given image using just PHP and GD.

In the previous post we saw how we can generate a screenshot from a url. In this post we will see how we can create a color palette of the screenshot (or any other image for that matter) using PHP and GD. This can be useful if you need to quickly get the color scheme of a website or a image. Below are a few example images and their palettes generated using the program.

With the help of his code it's as easy as a call on a GetMostCommonColors object (get_color) to return the hex codes for the values found most. Also included in the post is a sample snippet showing how to pull the details from the file and output it in a grid similar to this.

tagged: gd image process color palette popular tutorial

Link:

WebReference.com:
User Personalization with PHP: Beginning the Application
Feb 26, 2009 @ 08:44:25

WebReference.com has kicked off a new series of tutorials today with this first part of their look at building a personalization system as a part of a bookmarking system.

In this tutorial we will build an online bookmark system. This will be used to create a database for storing all our URL's and their descriptions. There are many commercial and non-commercial applications that offer almost the exact functionality that we will create in our application; the difference is that we have full control over our application, allowing us to tweak it to suit our needs.

The application lets users login/logout, manage bookmarks, gives recommendations based on those bookmarks, show some news headlines and, most importantly, the user must be able to personalize their interface with a custom color scheme and image of their choosing.

This first part gets up to the point of creating the databases (a bookmarks and users tables) and creating the basic template wrapper for the entire site.

tagged: user personalize application tutorial bookmark image color scheme

Link:

Andreas Gohr's Blog:
Calculating Color Contrast with PHP
Sep 19, 2008 @ 09:37:37

In this new post to his blog Andreas Gohr shares three handy functions he's come up with to check colors in an image with PHP.

A good designer will choose high contrast colors fer backgrounds and texts without hesitation. But sometimes no human is involved in choosin' th' colors. For example when colors are assigned in a (pseudo) random manner. [...] After some googlin' I found a page explainin' different color contrast algorithms. Load the cannons! I used th' data from that page and implemented 3 color check functions in PHP.

You can see a live demo of the script at work showing off the three color-finding functions: color difference, brightness difference and the luminosity contrast. There's also a method for calculating the Pythagorean distance between the colors included now too.

tagged: color contrast tutorial brightness luminosity

Link:

Ibuildings Blog:
Implementing Iterators
Aug 20, 2008 @ 15:02:59

On the Ibuildings blog Ruud Alberts takes a look at iterators - what they are and how they're used (including the objects the SPL makes available).

Let's kickstart this blogpost by defining what an iterator actually is. According to wikipedia, an iterator is. A collection can pretty much be anything. The most obvious sources would be arrays, but other than that, iterations can be done over database resultsets, strings, datetime intervals, directories, file content and XML listings, to name a few.

He looks at the iterator interface that comes bundled in the SPL and how you can create a custom one to loop through your own data collection. He includes an example - a colorful string iterator that "pretties up" an HTML string with various colors.

tagged: iterator standard library spl custom color string tutorial

Link:

Sebastian Bergmann's Blog:
ANSI Colors in PHPUnit Output
Mar 20, 2008 @ 10:26:51

Sebastian Bergmann shows off a new feature of the latest PHPUnit release - the addition of ANSI colors to the runner's output.

Check out the screenshots here and here.

PHPunit is a member of the xUnit family of testing frameworks and provides both a framework that makes the writing of tests easy as well as the functionality to easily run the tests and analyse their results.

tagged: phpunit output unittest runner ansi color

Link:

Mikko Koppanen's Blog:
Padding thumbnail with color
Jan 11, 2008 @ 12:05:00

Mikko Koppanen has another image tutorial posted to his blog today - this time the focus is on padding a thumbnail with the color of your choice automatically.

Today's example originates from a question asked by a user. How do I thumbnail the image inside given dimensions proportionally and fill the "blank" areas with a color? Well, the answer is here.

His code pulls in the source image, generates a thumbnail from it and makes a new image (the background) that's a bit bigger than the thumbnail. From there, the thumbnail is laid on top and the whole thing is output as another PNG. An example of the input and output image is included.

tagged: imagick padding thumbnail color example imagick padding thumbnail color example

Link:

Mikko Koppanen's Blog:
Padding thumbnail with color
Jan 11, 2008 @ 12:05:00

Mikko Koppanen has another image tutorial posted to his blog today - this time the focus is on padding a thumbnail with the color of your choice automatically.

Today's example originates from a question asked by a user. How do I thumbnail the image inside given dimensions proportionally and fill the "blank" areas with a color? Well, the answer is here.

His code pulls in the source image, generates a thumbnail from it and makes a new image (the background) that's a bit bigger than the thumbnail. From there, the thumbnail is laid on top and the whole thing is output as another PNG. An example of the input and output image is included.

tagged: imagick padding thumbnail color example imagick padding thumbnail color example

Link: