--- signwriter.module.orig 2009-08-12 09:53:44.000000000 -0700 +++ signwriter.module 2009-08-12 10:23:20.000000000 -0700 @@ -719,16 +719,26 @@ function signwriter_image_calc_dimension */ function signwriter_create_image($image, $profile, $width, $height) { // create the image + /******* + * Todo: We should probably have support for a different background image for + * each of the idx values on threestate images, but for now, this fixes + * existing profiles from previous versions of signwriter. + **/ + $idx=0; if (!empty($image->bgimage[$idx])) { $imagefunction = 'imagecreatefrom'. $image->bgimagetype[$idx]; - $image->im = $imagefunction($image->bgimage); - $width = imagesx($image->im); - $height = imagesy($image->im); + $image->im = $imagefunction($image->bgimage[$idx]); + if(!$width){ + $width = imagesx($image->im); + } + if(!$height){ + $height = imagesy($image->im); + } } else { $image->im = imagecreate($width, $height); } - + // pre allocate the colors for ($idx = 0; $idx < ($profile->threestate ? 3 : 1); $idx++) { $image->background[$idx] = imagecolorallocate($image->im, $image->bg[$idx][0], $image->bg[$idx][1], $image->bg[$idx][2]);