@@ -173,9 +173,9 @@ |
||
173 | 173 | $chosen_icons = array(); |
174 | 174 | $p = 0; |
175 | 175 | while ($total_icons > 0) { |
176 | - if (!$this->use_diferent_depths) { |
|
177 | - while (isset($icons[$p + 1]) && $icons[$p]['size'] == $last_size) $p++; |
|
178 | - } |
|
176 | + if (!$this->use_diferent_depths) { |
|
177 | + while (isset($icons[$p + 1]) && $icons[$p]['size'] == $last_size) $p++; |
|
178 | + } |
|
179 | 179 | if (!isset($icons[$p])) break; |
180 | 180 | $chosen_icons[] = $icons[$p]['index']; |
181 | 181 | $last_size = $icons[$p++]['size']; |
@@ -174,9 +174,13 @@ |
||
174 | 174 | $p = 0; |
175 | 175 | while ($total_icons > 0) { |
176 | 176 | if (!$this->use_diferent_depths) { |
177 | - while (isset($icons[$p + 1]) && $icons[$p]['size'] == $last_size) $p++; |
|
177 | + while (isset($icons[$p + 1]) && $icons[$p]['size'] == $last_size) { |
|
178 | + $p++; |
|
179 | + } |
|
178 | 180 | } |
179 | - if (!isset($icons[$p])) break; |
|
181 | + if (!isset($icons[$p])) { |
|
182 | + break; |
|
183 | + } |
|
180 | 184 | $chosen_icons[] = $icons[$p]['index']; |
181 | 185 | $last_size = $icons[$p++]['size']; |
182 | 186 | $total_icons--; |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | - define('PATH', dirname(__FILE__) . '/'); |
|
2 | + define('PATH', dirname(__FILE__) . '/'); |
|
3 | 3 | |
4 | 4 | include PATH . 'class.icothumb.php'; |
5 | 5 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return boolean Success |
62 | 62 | **/ |
63 | 63 | function LoadFile($path) { |
64 | - $this->_filename = $path; |
|
64 | + $this->_filename = $path; |
|
65 | 65 | if (($fp = @fopen($path, 'rb')) !== false) { |
66 | 66 | $data = ''; |
67 | 67 | while (!feof($fp)) { |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | $c = array(); |
263 | 263 | for ($i = 0; $i < $this->formats[$index]['ColorCount']; $i++) { |
264 | 264 | $c[$i] = $this->AllocateColor($im, $this->formats[$index]['colors'][$i]['red'], |
265 | - $this->formats[$index]['colors'][$i]['green'], |
|
266 | - $this->formats[$index]['colors'][$i]['blue'], |
|
267 | - round($this->formats[$index]['colors'][$i]['reserved'] / 255 * 127)); |
|
265 | + $this->formats[$index]['colors'][$i]['green'], |
|
266 | + $this->formats[$index]['colors'][$i]['blue'], |
|
267 | + round($this->formats[$index]['colors'][$i]['reserved'] / 255 * 127)); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | **/ |
274 | 274 | $width = $this->formats[$index]['Width']; |
275 | 275 | if (($width % 32) > 0) { |
276 | - $width += (32 - ($this->formats[$index]['Width'] % 32)); |
|
276 | + $width += (32 - ($this->formats[$index]['Width'] % 32)); |
|
277 | 277 | } |
278 | 278 | $offset = $this->formats[$index]['Width'] * $this->formats[$index]['Height'] * $this->formats[$index]['BitCount'] / 8; |
279 | 279 | $total_bytes = ($width * $this->formats[$index]['Height']) / 8; |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | $color = substr($this->formats[$index]['data'], $offset, 4); |
306 | 306 | if (ord($color[3]) > 0) { |
307 | 307 | $c = $this->AllocateColor($im, ord($color[2]), |
308 | - ord($color[1]), |
|
309 | - ord($color[0]), |
|
310 | - 127 - round(ord($color[3]) / 255 * 127)); |
|
308 | + ord($color[1]), |
|
309 | + ord($color[0]), |
|
310 | + 127 - round(ord($color[3]) / 255 * 127)); |
|
311 | 311 | imagesetpixel($im, $j, $i, $c); |
312 | 312 | } |
313 | 313 | $offset += 4; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Extract each icon header |
98 | 98 | **/ |
99 | - for ($i = 0; $i < $this->ico['Count']; $i ++) { |
|
99 | + for ($i = 0; $i < $this->ico['Count']; $i++) { |
|
100 | 100 | $icodata = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $data); |
101 | 101 | $icodata['FileOffset'] -= ($this->ico['Count'] * 16) + 6; |
102 | 102 | if ($icodata['ColorCount'] == 0) $icodata['ColorCount'] = 256; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * paint background |
243 | 243 | **/ |
244 | 244 | $bgcolor = $this->AllocateColor($im, $this->bgcolor[0], $this->bgcolor[1], $this->bgcolor[2]); |
245 | - imagefilledrectangle($im, 0 , 0, $this->formats[$index]['Width'], $this->formats[$index]['Height'], $bgcolor); |
|
245 | + imagefilledrectangle($im, 0, 0, $this->formats[$index]['Width'], $this->formats[$index]['Height'], $bgcolor); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * set background color transparent |
@@ -99,7 +99,9 @@ |
||
99 | 99 | for ($i = 0; $i < $this->ico['Count']; $i ++) { |
100 | 100 | $icodata = unpack("CWidth/CHeight/CColorCount/CReserved/SPlanes/SBitCount/LSizeInBytes/LFileOffset", $data); |
101 | 101 | $icodata['FileOffset'] -= ($this->ico['Count'] * 16) + 6; |
102 | - if ($icodata['ColorCount'] == 0) $icodata['ColorCount'] = 256; |
|
102 | + if ($icodata['ColorCount'] == 0) { |
|
103 | + $icodata['ColorCount'] = 256; |
|
104 | + } |
|
103 | 105 | $this->formats[] = $icodata; |
104 | 106 | |
105 | 107 | $data = substr($data, 16); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | - define('PATH', dirname(__FILE__) . '/'); |
|
2 | + define('PATH', dirname(__FILE__) . '/'); |
|
3 | 3 | |
4 | - include PATH . 'class.ico.php'; |
|
4 | + include PATH . 'class.ico.php'; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Change this to a local icon |
8 | 8 | **/ |
9 | - $ico = new Ico('http://www.diogoresende.net/news/wp-content/pics.ico'); |
|
9 | + $ico = new Ico('http://www.diogoresende.net/news/wp-content/pics.ico'); |
|
10 | 10 | $ico->SetBackground('#abcdef'); |
11 | 11 | $im = $ico->GetIcon(9); |
12 | 12 |