Author Archives: james

php imagick rounded rectangle with border

In this post I will show you how to “draw” a rounded rectangle with a border. This will involve creating a new ImagickDraw object, then applying your draw settings to an Imagick object. First, set up all your colors, image size, border width, and corner radius. After you have set all the input variables, the […]

php imagick simple vertical or horizontal gradient image

In this post I will show you how to create a simple vertical gradient with php’s imagick object. First, set some variables for the colors you want. In this example we are creating a simple 2 color gradient on a opaque background. Once you have specified which colors you want for the background, the top […]

php imagick simple font rendering with automatic image canvas size

I have been working with the image imagick library for PHP (ImageMagick) for some time now. I figure its time to share what I have discovered and figured out. There is very little documentation on this amazing library for PHP, but hopefully my hours of trial and error can help those who are interested in […]

OSX Finder New File Contextual Menu Item Using Automator

I have always been annoyed that there is no “New File” contextual menu item in OS X’s Finder. I mean, common Apple, why no new file? Anyway, after looking around I found some packages that don’t work with Snow Leopard. So I decided to see what I could do with Automator. Low and behold, there […]

Yet another Prototype Colorpicker

And then there was another…..color….picker…. I have been dissatisfied with all the prototype color pickers out there, so when I found this jQuery colorpicker, I decided to port it to prototype. Yay! It has lots of options. Examples/Demo available here, download available here. This color picker allows you to not only select your color, but […]

Textarea auto re-size function….

So I had to create an auto re-size function for textareas. I looked around on the net and found a few things, but nothing really did what i wanted…. so I wrote this quick and dirty function to determine the pixel height a textarea should be based on the number of new lines and length […]

String Functions for Javascript – trim, to camel case, to dashed, and to underscore

So I was messing with a little template builder, and decided to try and dynamically read and write CSS to elements on a page. This brought up the difference between JavaScript having camel case representations of the dashed css properties. Soooooo, I had to write little string functions to convert camel case to dashed strings […]

simplexml to array

Sometimes dealing with PHP’s simplexml object can be annoying, and you just wish it was a simple array. There are a ton of functions out there for that, but I’ve found this one works best =) Source: http://www.php.net/manual/en/ref.simplexml.php function simplexml2array($xml) { if (get_class($xml) == ‘SimpleXMLElement’) { $attributes = $xml->attributes(); foreach($attributes as $k=>$v) { if ($v) […]

Polar Arc Animation Using Canvas and Prototype

This is a little class I created to use Canvas to create a polar arc animation. A while ago I came across a Polar Clock using canvas and I thought it would be cool to create a randomized background using the same concepts. I would link back to the original script I based this on, […]

Wack Mac newline character in utf-8

So I had a user come to me with with an error with my WYSIWYG editor in our online website builder. He would save his content, which he had pasted from OSX’s TextEdit program, then try to apply that content to his website. I have a PHP function which escapes new lines and single quotes […]