Last change
on this file was 347, checked in by roby, 4 years ago |
Aggiornamento per compatibilità con php7.4
|
File size:
681 bytes
|
Rev | Line | |
---|
[347] | 1 | <?php
|
---|
| 2 | $px = isset($_GET['px']) ? $_GET['px'] : 0;
|
---|
| 3 | $px = preg_replace('/[^0-9]/isU', '', $px);
|
---|
| 4 |
|
---|
| 5 | $py = isset($_GET['py']) ? $_GET['py'] : 0;
|
---|
| 6 | $py = preg_replace('/[^0-9]/isU', '', $py);
|
---|
| 7 |
|
---|
| 8 | if ($px<1) {
|
---|
| 9 | $px = 5;
|
---|
| 10 | }
|
---|
| 11 | if ($py<1) {
|
---|
| 12 | $py = 5;
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | if ($px>20) {
|
---|
| 16 | $px = 20;
|
---|
| 17 | }
|
---|
| 18 | if ($py>20) {
|
---|
| 19 | $py = 20;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | $width = 100;
|
---|
| 23 | $height = 100;
|
---|
| 24 | $im = imagecreatetruecolor($width, $height);
|
---|
| 25 |
|
---|
| 26 | for ($y=0; $y<$height; $y+= $py) {
|
---|
| 27 | for ($x=0; $x<$width; $x+= $px) {
|
---|
| 28 | $c = imagecolorallocate($im, 200-$x, 100+$y, 100+$x-$y);
|
---|
| 29 | imagefilledrectangle($im, $x, $y, $x+$px, $y+$py, $c);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | header("Content-type: image/png");
|
---|
| 34 | imagepng($im);
|
---|
| 35 | imagedestroy($im);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.