Zebra_Image.php
private function _prepare_image($width, $height, $background_color = '#FFFFFF') {

        // create a blank image
        $identifier = imagecreatetruecolor((int)$width <= 0 ? 1 : (int)$width, (int)$height <= 0 ? 1 : (int)$height);

        // if we are creating a transparent image, and image type supports transparency
        if ($background_color == -1 && $this->target_type != 'jpg') {

            // disable blending
            imagealphablending($identifier, false);

            // allocate a transparent color
            $background_color = imagecolorallocatealpha($identifier, 0, 0, 0, 127);

            // we also need to set this for saving gifs
            imagecolortransparent($identifier, $background_color);

            // save full alpha channel information
			imagesavealpha($identifier, true);

        // if we are not creating a transparent image
        } else {

            // convert hex color to rgb
            $background_color = $this->_hex2rgb($background_color);

            // prepare the background color
            $background_color = imagecolorallocate($identifier, $background_color['r'], $background_color['g'], $background_color['b']);

        }

        // fill the image with the background color
        imagefill($identifier, 0, 0, $background_color);

        // return the image's identifier
        return $identifier;

    }
private function _prepare_image($width, $height, $background_color = '#FFFFFF') {

        // create a blank image
        $identifier = imagecreatetruecolor((int)$width <= 0 ? 1 : (int)$width, (int)$height <= 0 ? 1 : (int)$height);

        // if we are creating a transparent image, and image type supports transparency
        if ($background_color == -1 && $this->target_type != 'jpg') {

            // disable blending
            imagealphablending($identifier, false);

            // allocate a transparent color
            $background_color = imagecolorallocatealpha($identifier, 0, 0, 0, 127);

            // we also need to set this for saving gifs
            imagecolortransparent($identifier, $background_color);

            // save full alpha channel information
			imagesavealpha($identifier, true);

        // if we are not creating a transparent image
        } else {

            // convert hex color to rgb
            $background_color = $this->_hex2rgb($background_color);

            // prepare the background color
            $background_color = imagecolorallocate($identifier, $background_color['r'], $background_color['g'], $background_color['b']);

        }

        // fill the image with the background color
        imagefill($identifier, 0, 0, $background_color);

        // return the image's identifier
        return $identifier;

    }
private function _prepare_image ( $ width , $ height , $ background_color = '#FFFFFF' ) { // create a blank image
 $ identifier = imagecreatetruecolor ( ( int ) $ width <= 0 ? 1 : ( int ) $ width , ( int ) $ height <= 0 ? 1 : ( int ) $ height ) ; // if we are creating a transparent image, and image type supports transparency
 if ( $ background_color == - 1 && $ this -> target_type != 'jpg' ) { // disable blending
 imagealphablending ( $ identifier , false ) ; // allocate a transparent color
 $ background_color = imagecolorallocatealpha ( $ identifier , 0 , 0 , 0 , 127 ) ; // we also need to set this for saving gifs
 imagecolortransparent ( $ identifier , $ background_color ) ; // save full alpha channel information
 imagesavealpha ( $ identifier , true ) ; // if we are not creating a transparent image
 } else { // convert hex color to rgb
 $ background_color = $ this -> _hex2rgb ( $ background_color ) ; // prepare the background color
 $ background_color = imagecolorallocate ( $ identifier , $ background_color [ 'r' ] , $ background_color [ 'g' ] , $ background_color [ 'b' ] ) ; } // fill the image with the background color
 imagefill ( $ identifier , 0 , 0 , $ background_color ) ; // return the image's identifier
 return $ identifier ; }
Creates a blank image of given width, height and background color.

@param  integer     $width              Width of the new image.

@param  integer     $height             Height of the new image.

@param  string      $background_color   (Optional) The hexadecimal color of the background.

Can also be -1 case in which the script will try to create a transparent
image, if possible.

Default is #FFFFFF.

@return                                 Returns the identifier of the newly created image.

@access private
Creates a blank image of given width height and background color .