I got 12 .php files with this code:
if($_GET['u']){
$srcp = imagecreatefrompng("http://www.minecraft.net/skin/".$_GET['u'].".png");
$destp = imagecreate(1200, 1800);
imagecopyresampled($destp, $srcp, 0, 0, 20, 20, 1200, 1800, 8, 12);
header('Content-type: image/png');
imagepng($destp);
}
Yes only thing that seperates the different files is the positions of the image. Now can I have many of that lines in PHP? I tried taking that line and a line from another file and just renamed u to b in that case but it didn’t work….
I tried like this without any good result (only u worked):
if($_GET['u']){
$srcp = imagecreatefrompng("http://www.minecraft.net/skin/".$_GET['u'].".png");
$destp = imagecreate(1200, 1800);
imagecopyresampled($destp, $srcp, 0, 0, 20, 20, 1200, 1800, 8, 12);
header('Content-type: image/png');
imagepng($destp);
}
if($_GET['b']){
$srcp = imagecreatefrompng("http://www.minecraft.net/skin/".$_GET['b'].".png");
$destp = imagecreate(600, 1800);
imagecopyresampled($destp, $srcp, 0, 0, 16, 20, 600, 1800, 4, 12);
header('Content-type: image/png');
imagepng($destp);
}
So Do anyone know how to kinda put all my 12 lines of code from 12 PHP files into 1 php file? :/
Thanks in advance, enji
I think, in this case, since the file is always the same path, you should just add a second
$_GETand use it as a type with a switch:I’ll second webjawns.com’s warning to never trust the input value of a
$_GET. serialworm offers an very easy way of filtering the input with$u = strip_tags($_GET['u']);