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
JamalBIG
post
Post #2





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

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


Wyszlo cos takiego ale nadal nic... Pojawiaja sie takie ostrzezenia:

Cytat
Warning: imagesx(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 45

Warning: imagesy(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 46

Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in c:\usr\apache\httpd\html\index.php on line 62

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 63

Warning: imagefill(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 65

Warning: imagecopyresampled(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 66

Warning: imagejpeg(): supplied argument is not a valid Image resource in c:\usr\apache\httpd\html\index.php on line 70


  1. <?php
  2. if ($cat == "c1") {
  3. $cat = "videos";
  4. } else {
  5. $cat = "torrents";
  6. }
  7. $file = $_FILES['my_file']['name'];
  8. $file = str_replace(' ', '', $file);
  9. $r = explode('.',$file);
  10. $r = $r[0];
  11. $r = str_replace(' ', '', $r);
  12.  
  13. $filename = "downloads/$cat/$file";
  14. if (file_exists($filename)) {
  15. echo "Plik $filename juz istnieje $file";
  16. } else {
  17. mkdir ("downloads/$cat/$r");
  18.  if(isset($_FILES['my_file'])) {
  19. if(is_uploaded_file($_FILES['my_file']['tmp_name'])) {
  20. move_uploaded_file($_FILES['my_file']['tmp_name'], "downloads/$cat/$r/$file");
  21. }
  22. }
  23. $pic = $_FILES['my_pic']['name'];
  24. $pic = str_replace(' ', '', $pic);
  25. $p = explode('.',$pic);
  26. $p = $r[0];
  27. $p = str_replace(' ', '', $p);
  28. if(isset($_FILES['my_pic'])) {
  29. if(is_uploaded_file($_FILES['my_pic']['tmp_name'])) {
  30. move_uploaded_file($_FILES['my_pic']['tmp_name'], "downloads/$cat/$r/$pic");
  31. }
  32. }
  33. echo "Plik downloads/$cat/$r/$file zostal dodany";
  34. }
  35.  
  36. function makeIcons_MergeCenter($in, $out, $max_width, $max_height, $jakosc = 80) //mała poprawka 
  37. {
  38.  
  39. $typ = img_typ($in);
  40.  
  41. if ($typ == ".jpg") {$img_src = imagecreatefromjpeg($in);}
  42. elseif($typ == ".gif") {$img_src = imagecreatefromgif($in); }
  43. elseif($typ == ".png") {$img_src = imagecreatefrompng($in); }
  44.  
  45. $x = imagesx($img_src);
  46. $y = imagesy($img_src);
  47.  
  48. if($x > $y) 
  49. {
  50. $xr = ($x > $max_width)$max_width/$x : 1;
  51. $yr = $xr;
  52. }
  53. else 
  54. {
  55. $yr = ($y > $max_height)$max_height/$y : 1;
  56. $xr = $yr;
  57. }
  58.  
  59. $new_x = $x*$xr;
  60. $new_y = $y*$yr;
  61.  
  62. $new_img = imagecreatetruecolOR($new_x, $new_y);
  63. $background = imagecolORallocate($new_img, 255, 255, 255);
  64.  
  65. imagefill($new_img, 0, 0, $background);
  66. imagecopyresampled($new_img, $img_src, 0, 0, 0, 0, $new_x, $new_y, $x, $y);
  67.  
  68. $typ = img_typ($out);
  69.  
  70. if ($typ == ".jpg") {imagejpeg($new_img, $out, $jakosc);}
  71. elseif($typ == ".png") { imagepng($new_img, $out, $jakosc);}
  72. elseif($typ == ".gif") { imagegif($new_img, $out);  }
  73. }
  74.  
  75. function img_typ($name) 
  76. {
  77. $name = strtolower(substr($name, -4, 4));
  78.  
  79. if($name == '.jpg' OR $name == 'jpeg') 
  80. {
  81. return ".jpg";
  82. }
  83. elseif($name == '.gif') 
  84. {
  85. return ".gif";
  86. }
  87. elseif($name == '.png')
  88. {
  89. return ".png";
  90. }
  91. }
  92.  
  93. makeIcons_MergeCenter('downloads/$cat/$r/$file', 'downloads/$cat/$r/thumb.jpg', 200, 200);
  94. ?>
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 - 23:58