Редакция 82 | К новейшей редакции | Весь файл | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 82 | Редакция 83 | ||
---|---|---|---|
Строка 36... | Строка 36... | ||
36 | $distua = mysql_real_escape_string($_POST["distUA"]); |
36 | $distua = mysql_real_escape_string($_POST["distUA"]); |
37 | $disttype = abs(intval($_POST["distType"])); |
37 | $disttype = abs(intval($_POST["distType"])); |
38 | 38 | ||
39 | $distlogo = 0; |
39 | $distlogo = 0; |
40 | if ($_FILES["distLOGO"]["type"]!=0) { |
40 | if ($_FILES["distLOGO"]["type"]!=0) { |
41 | $folder = "./img/logo/".stripslashes($distua)."-orig.png"; |
41 | $folder = dirname(__FILE__)."/img/logo/".stripslashes($distua)."-orig.png"; |
42 | $folderN = "./img/logo/".stripslashes($distua).".png"; |
42 | $folderN = dirname(__FILE__)."/img/logo/".stripslashes($distua).".png"; |
43 | $folderEM = "./img/logo/".stripslashes($distua)."-em.png"; |
43 | $folderEM = dirname(__FILE__)."/img/logo/".stripslashes($distua)."-em.png"; |
44 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
44 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
45 | chmod($folder, 0644); |
45 | chmod($folder, 0644); |
46 | list($width, $height) = GetImageSize($folder); |
46 | list($width, $height) = GetImageSize($folder); |
47 | $percent = 32/$height; |
47 | $percent = 32/$height; |
48 | $newwidth = $width * $percent; |
48 | $newwidth = $width * $percent; |
Строка 76... | Строка 76... | ||
76 | $distname = mysql_real_escape_string($_POST["distName"]); |
76 | $distname = mysql_real_escape_string($_POST["distName"]); |
77 | $distua = mysql_real_escape_string($_POST["distUA"]); |
77 | $distua = mysql_real_escape_string($_POST["distUA"]); |
78 | $disttype = abs(intval($_POST["distType"])); |
78 | $disttype = abs(intval($_POST["distType"])); |
79 | $distID = abs(intval($_POST["distID"])); |
79 | $distID = abs(intval($_POST["distID"])); |
80 | 80 | ||
81 | if ($_FILES["distLOGO"]["type"]!=0) { |
81 | if ($_FILES["distLOGO"]["type"]!='') { |
82 | $folder = "./img/logo/".stripslashes($distua)."-orig.png"; |
82 | $folder = dirname(__FILE__)."/img/logo/".$distua."-orig.png"; |
83 | $folderN = "./img/logo/".stripslashes($distua).".png"; |
83 | $folderN = dirname(__FILE__)."/img/logo/".$distua.".png"; |
84 | $folderEM = "./img/logo/".stripslashes($distua)."-em.png"; |
84 | $folderEM = dirname(__FILE__)."/img/logo/".$distua."-em.png"; |
85 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
85 | if (move_uploaded_file($_FILES["distLOGO"]["tmp_name"],$folder)) { |
86 | chmod ($folder, 0644); |
86 | chmod ($folder, 0644); |
87 | list($width, $height) = GetImageSize($folder); |
87 | list($width, $height) = GetImageSize($folder); |
88 | $percent = 32/$height; |
88 | $percent = 32/$height; |
89 | $newwidth = $width * $percent; |
89 | $newwidth = $width * $percent; |
90 | $newheight = $height * $percent; |
90 | $newheight = $height * $percent; |
91 | 91 | ||
92 | $output = ImageCreateTrueColor($newwidth, $newheight); |
92 | $output = ImageCreateTrueColor($newwidth, $newheight); |
- | 93 | $black = ImageColorAllocate($output, 0, 0, 0); |
|
93 | $source = ImageCreateFromPNG($folder); |
94 | $source = ImageCreateFromPNG($folder); |
94 | 95 | ||
95 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
96 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
- | 97 | ImageColorTransparent($output, $black); |
|
96 | ImagePNG($output, $folderEM); |
98 | ImagePNG($output, $folderEM); |
97 | 99 | ||
98 | $percent = 15/$height; |
100 | $percent = 15/$height; |
99 | $newwidth = $width * $percent; |
101 | $newwidth = $width * $percent; |
100 | $newheight = $height * $percent; |
102 | $newheight = $height * $percent; |
101 | 103 | ||
102 | $output = ImageCreateTrueColor($newwidth, $newheight); |
104 | $output = ImageCreateTrueColor($newwidth, $newheight); |
- | 105 | $black = ImageColorAllocate($output, 0, 0, 0); |
|
103 | 106 | ||
104 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
107 | ImageCopyResized($output, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); |
- | 108 | ImageColorTransparent($output, $black); |
|
105 | ImagePNG($output, $folderN); |
109 | ImagePNG($output, $folderN); |
106 | 110 | ||
107 | unlink($folder); |
111 | unlink($folder); |
108 | 112 | ||
109 | $res =& $db->query("UPDATE distribution SET distlogo='1' WHERE dist_id='$distID'"); |
113 | $res =& $db->query("UPDATE distribution SET distlogo='1' WHERE dist_id='$distID'"); |