Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie zmiennej z innej funkcji?
JamalBIG
post
Post #1





Grupa: Zarejestrowani
Postów: 496
Pomógł: 1
Dołączył: 16.01.2008
Skąd: Świnoujście

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


Witam

W jaki sposob zrobic aby funkcja jakasfunkcja() pobierala zmienna $nazwa ktora jest nad nia?

$nazwa = "nazwa";
function jakasfunkcja()
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
b_chmura
post
Post #2





Grupa: Zarejestrowani
Postów: 813
Pomógł: 34
Dołączył: 18.03.2007
Skąd: o stamtąd

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


spróbuj tak
  1. <?php
  2. function makeIcons_MergeCenter($in, $out, $max_width, $max_height, $jakosc = 80) 
  3. {
  4.  
  5. $typ = img_typ($in);
  6. /*
  7. if ($typ == ".jpg") {$img_src = imagecreatefromjpeg($in);}
  8. elseif($typ == ".gif") {$img_src = imagecreatefromgif($in); }
  9. elseif($typ == ".png") {$img_src = imagecreatefrompng($in); }
  10. */
  11. $img_src = $in;
  12. $x = imagesx($img_src);
  13. $y = imagesy($img_src);
  14.  
  15. if($x > $y) 
  16. {
  17. $xr = ($x > $max_width)$max_width/$x : 1;
  18. $yr = $xr;
  19. }
  20. else 
  21. {
  22. $yr = ($y > $max_height)$max_height/$y : 1;
  23. $xr = $yr;
  24. }
  25.  
  26. $new_x = $x*$xr;
  27. $new_y = $y*$yr;
  28.  
  29. $new_img = imagecreatetruecolOR($new_x, $new_y);
  30. $background = imagecolORallocate($new_img, 255, 255, 255);
  31.  
  32. imagefill($new_img, 0, 0, $background);
  33. imagecopyresampled($new_img, $img_src, 0, 0, 0, 0, $new_x, $new_y, $x, $y);
  34.  
  35. $typ = img_typ($out);
  36.  
  37. if ($typ == ".jpg") {imagejpeg($new_img, $out, $jakosc);}
  38. elseif($typ == ".png") { imagepng($new_img, $out, $jakosc);}
  39. elseif($typ == ".gif") { imagegif($new_img, $out);  }
  40. }
  41. ?>


ale nie obiecuje, nie mam na razie jak testować.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 14.10.2025 - 17:19