These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | $url = $_GET["url"]; |
||
4 | $file = urldecode($url); |
||
5 | $file = str_replace(" ","%20",$file); |
||
6 | |||
7 | $what = getimagesize($file); |
||
8 | switch(strtolower($what['mime'])) { |
||
9 | case 'image/png': |
||
10 | $img = imagecreatefrompng($file); |
||
11 | break; |
||
12 | case 'image/jpeg': |
||
13 | $img = imagecreatefromjpeg($file); |
||
14 | break; |
||
15 | case 'image/gif': |
||
16 | $img = imagecreatefromgif($file); |
||
17 | break; |
||
18 | default: die(); |
||
19 | } |
||
20 | |||
21 | $new = imagecreatetruecolor($what[0],$what[1]); |
||
22 | imagecopy($new,$img,0,0,0,0,$what[0],$what[1]); |
||
23 | |||
24 | header('Content-Type: image/jpeg'); |
||
25 | imagejpeg($new); |
||
26 | imagedestroy($new); |
||
27 | |||
28 | ?> |
||
0 ignored issues
–
show
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.