0 )
{
if( trim($_GET['name']) != "" && trim($_GET['format']) != "" )
{
$extension = trim($_GET['format']);
$name = trim($_GET['name']).".".$extension;
$filepath = 'uploads/'.$name;
if( file_exists($filepath) )
{
// header("Content-Type: image/jpg");
// header("Content-Type: image/png");
// header("Content-Transfer-Encoding: Binary");
header("Content-Disposition: attachment; filename=$name");
switch ($extension) {
case "png":
$copy = imagecreatefrompng($filepath);
imagepng($copy);
break;
case "jpg":
$copy = imagecreatefromjpeg($filepath);
imagejpeg($copy);
break;
case "gif":
$copy = imagecreatefromgif($filepath);
imagegif($copy);
break;
}
imagedestroy($name);
// echo "file exists.";
}
else
{
echo "no file exists
";
// echo $filepath;
}
} // trim($_GET['name']) != ""
else
{
echo "enter a file name and select a file format.
";
} // // trim($_GET['name']) != ""
} // if( count($_GET) > 0 )
?>