<?php
header ("Content-Type: image/jpeg");
$users_id = intval($_GET['id']);
if(preg_match('#^[\d]{1,10}$#',$users_id)){
if(preg_match('#^[\d]{10,11}\.jpeg$#',$_GET['read'])) {
  	$read = $_GET['read'];
  	$infile = "./foto/".$users_id."/".$read;
   	$image = imageresize("",$infile,66,82,90);
  }
}
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));
	$colors = ImagecolorAllocate($im1,244,17,16);
	ImageString ($im1, 2, 3, 67,"".$_SERVER['HTTP_HOST']."", $colors);
	imagejpeg($im1,$outfile,$quality);	
	imagedestroy($im);
	imagedestroy($im1);
	return $outfile;
}
?>