<?php
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");

header ("Content-Type: image/jpeg");
$users_id = intval($_GET['id']);
$users_other = intval($nm);
if($users_other == 1) { $sh = 128; $vy = 128; }
if($users_other == 2) { $sh = 128; $vy = 160; }
if($users_other == 3) { $sh = 132; $vy = 176; }
if($users_other == 4) { $sh = 176; $vy = 144; }
if($users_other == 5) { $sh = 176; $vy = 208; }
if($users_other == 6) { $sh = 176; $vy = 220; }
if($users_other == 7) { $sh = 208; $vy = 208; }
if($users_other == 8) { $sh = 240; $vy = 266; }
if($users_other == 9) { $sh = 240; $vy = 320; }
//----------
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,$sh,$vy,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));
	//$colors = ImagecolorAllocate($im1,255,11,55);
//	$colors = ImagecolorAllocate($im1,255,19,33);
//	ImageString ($im1, 6, 3, 0,"".$_SERVER['HTTP_HOST']."", $colors);
	//imageTTFText($im1,16,0,0,16,$colors,"/font.ttf",$_SERVER['HTTP_HOST']);	
	imagejpeg($im1,$outfile,$quality);
	imagedestroy($im);
	imagedestroy($im1);
	return $outfile;
}

?>