Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Gradient
Konami
post 30.05.2014, 09:32:41
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 3.04.2014

Ostrzeżenie: (0%)
-----


Chciałbym aby gradient był poziomy a nie pionowy :F

  1. <?php
  2.  
  3. function gradient($width, $height, $colorA16, $colorB16, $plik)
  4. {
  5. $krokow = 255;
  6. $im = @imagecreate($width, $height);
  7. $rA = hexdec(substr($colorA16, 0, 2)); $gA = hexdec(substr($colorA16, 2, 2)); $bA = hexdec(substr($colorA16, 4, 2));
  8. $rB = hexdec(substr($colorB16, 0, 2)); $gB = hexdec(substr($colorB16, 2, 2)); $bB = hexdec(substr($colorB16, 4, 2));
  9.  
  10. for ($i = 0; $i <= $krokow; $i++){
  11. $A=($i/$krokow);
  12. $B=(($krokow-$i)/$krokow);
  13. $el_color = imagecolorallocate($im, round($rA*$A+$rB*$B), round($gA*$A+$gB*$B), round($bA*$A+$bB*$B));
  14. imagefilledrectangle($im, 0, 0, $width, round($height*$B), $el_color);
  15. }
  16. imagejpeg($im,$plik,95);
  17. imagedestroy($im);
  18. }
  19.  
  20.  
  21.  
  22.  
  23. ?>


Ten post edytował Konami 30.05.2014, 09:37:18
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.06.2025 - 14:55