/** * Make the image greyscale: supported only for PHP => 5.* and PHP => 4.0.1 except for PHP 4.3.11 * * @param Asido_TMP &$tmp * @return boolean * @access protected */ function __grayscale(&$tmp) { // the shorter path: function already exists // if (function_exists('imagefilter')) { return imagefilter($tmp->target, IMG_FILTER_GRAYSCALE); return true; } // a bit wicked path: PHP 4.3.11 has a bug in this function // if (!in_array(PHP_VERSION, array('4.3.11'))) { return imageCopyMergeGray($tmp->target, $tmp->target, 0, 0, 0, 0, $tmp->image_width, $tmp->image_height, 0); } return false; }
/** * Make the image greyscale: supported only for PHP => 5.* and PHP => 4.0.1 except for PHP 4.3.11 * * @param asido_tmp $tmp * @return boolean * @access protected */ protected function __grayscale(asido_tmp $tmp) { // the shorter path: function already exists // if (function_exists('imagefilter')) { return imagefilter($tmp->target, IMG_FILTER_GRAYSCALE); return true; } // a bit wicked path: prior to `PHP 4.3.11` and // `PHP 5.0.4` there is a bug w/ imageCopyMergeGray() // if (version_compare(PHP_VERSION, '4.3.11') > 0 || version_compare(PHP_VERSION, '5.0.4') > 0) { return imageCopyMergeGray($tmp->target, $tmp->target, 0, 0, 0, 0, $tmp->image_width, $tmp->image_height, 0); } return false; }