Tag Archives: PHP

PHP sendmail 90 second delay on Dotcloud [solved]

For months we have been having upstream timeout issues with our Dotcloud PHP service running nginx and php-fpm. ¬†Amongst other causes, we found that after our instances were up for more than a day, php’s mail function using sendmail was consistantly taking exactly 90 seconds to send an email. ¬†Unacceptable. After going back and forth […]

mongodb geospatial query example in php with distance radius in miles and km

Recently for a project involving 311 reports in New York city, I had to find a speedy way to query over 3 million records within a certain radius of a latitude longitude point. Mysql is slow for this sort of thing, so I decided to try the data set out with Solr. Solr worked great […]

php mysql collation change script

There are times when we get stuck with bad collations on our mysql tables and we are overwhelmed by having to change them by hand. Well, I have written a php script which will go through all your tables and fields in a database and update them to the collation which works for you. In […]

php imagick complex gradient composite image

Manipulating images with imagemagick for php can be difficult, especially when you are trying to create complex images for a web template. Here is a more complex example of how to create sweet dynamic web graphics. This is a version of a header image that I created for a template design. It involves 4 colors, […]

simple but useful php base object for mysql table interaction

I started a project creating an online game which involved lots of objects and tables. Rather than rewrite the same code over and over, I decided to create a base object in which i could simple extend the base object to work with any mySQL table by simply listing all the fields. Here is the […]

php imagick round corner box with dropshadow

In this post I will show you how to create a rounded corner box with a drop shadow. First set your background color, foreground color, and the color of the drop shadow. Once you’ve set up your colors, the script will create two identical imagick objects, one for the background, and one for the foreground. […]

php imagick button with round corners and a bezier curve

This post involves a little more complex example of what imagick can do. I am going to show you how to use the draw object to create an button which has rounded corners and a multi-colored curve accent using the “bezier” function of the ImagickDraw object. First, lets get things set up. We are using […]

php imagick add round corners to a jpg image

One might think this would be an easy task, and it is, unless you want it to look good. Unfortunately, imagick really only performs well when processing images with an alpha channel. I’ve found that PNG format works best. So, to add rounded corners to a jpg image with php’s imagick object, there are a […]

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 […]