$frsy = $sy - floor($sy); $frsx1 = 1 - $frsx; $frsy1 = 1 - $frsy; // вычисление цвета нового пикселя как пропорции от цвета основного пикселя и его соседей $newcolor = floor($color * $frsx1 * $frsy1 + $color_x * $frsx * $frsy1 + $color_y * $frsx1 * $frsy + $color_xy * $frsx * $frsy); } imagesetpixel($result_MultiWave->gd, $x, $y, imagecolorallocate($result_MultiWave->gd, $newcolor, $newcolor, $newcolor)); } } // Сглаживание if (function_exists('imageconvolution')) { $matrix = array(array(1, 2, 1), array(2, 4, 2), array(1, 2, 1)); imageconvolution($result_MultiWave->gd, $matrix, 16, 0); } // Добавляем рамку //if($border > 0){ // imagerectangle($result_MultiWave->gd, 0, 0, $result_MultiWave->Width-1, $result_MultiWave->Height-1, $border_color); //} // ----------------------------------------------------------------------- header('Expires: Mon, 1 Jan 2006 00:00:00 GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', FALSE); header('Pragma: no-cache'); $result_MultiWave->SendToHTTPClient(); $captcha->Destruct(); $result_image->Destruct(); $result_MultiWave->Destruct(); System::user()->Def('captcha_keystring', $code); // Восстанавливаем Referer System::user()->Def('REFERER', $_SERVER['HTTP_REFERER']); exit;
/** * Добавляет водяной знак на изображение * @param $place * @param int $transparency */ public function AddWatermark($place, $transparency = 50) { $wm = new TPicture($this->WatermarkFile); if ($transparency > 100) { $transparency = 100; } elseif ($transparency < 1) { $transparency = 1; } switch ($place) { case 'center': ImageCopyMerge($this->gd, $wm->gd, ($this->Width - $wm->Width) / 2, ($this->Height - $wm->Height) / 2, 0, 0, $wm->Width, $wm->Height, $transparency); break; case 'top_left': ImageCopyMerge($this->gd, $wm->gd, 0, 0, 0, 0, $wm->Width, $wm->Height, $transparency); break; case 'top_right': ImageCopyMerge($this->gd, $wm->gd, $this->Width - $wm->Width, 0, 0, 0, $wm->Width, $wm->Height, $transparency); break; case 'down_right': ImageCopyMerge($this->gd, $wm->gd, $this->Width - $wm->Width, $this->Height - $wm->Height, 0, 0, $wm->Width, $wm->Height, $transparency); break; case 'down_left': ImageCopyMerge($this->gd, $wm->gd, 0, $this->Height - $wm->Height, 0, 0, $wm->Width, $wm->Height, $transparency); break; } $wm->Destruct(); }