<?php
header ("Content-Type: image/jpeg");
$users_id = intval($_GET['id']);
$users_read = htmlspecialchars($_GET['f']);
if(preg_match('#^[\d]{1,10}$#',$users_id)){
if(preg_match('#^[\d]{10,11}\.jpeg$#',$users_read)) {
  	$read = $users_read;
  	$infile = "./foto/".$users_id."/".$read;
  	$arr = getimagesize($infile);
   	$image = imageresize("",$infile,$arr[0],$arr[1],100);
  }
}
function imageresize ($outfile,$infile,$neww,$newh,$quality) {
	$im=imagecreatefromjpeg($infile);
	$im1=imagecreatetruecolor($neww,$newh);
	imagecopyresampled ($im1,$im,0,0,0,0,$neww,$newh,imagesx($im),imagesy($im));
	imagejpeg($im1,$outfile,$quality);	
	imagedestroy($im);
	imagedestroy($im1);
	return $outfile;
}

?>