$b)^$forcefill) { $src_rect_width = $a * $height; $src_rect_height = $height; if(!$forcefill) { $src_rect_width = $width; $th_width = $th_height/$height*$width; } } else { $src_rect_height = $width/$a; $src_rect_width = $width; if(!$forcefill) { $src_rect_height = $height; $th_height = $th_width/$width*$height; } } /* $sql = "SELECT `POIX`,`POIY` FROM `Media` WHERE `file` = '{$_GET['f']}' AND `POIX` > 0 AND `POIY` > 0"; $qry = mysql_query($sql); if(mysql_num_rows($qry)){ list($poix,$poiy) = mysql_fetch_row($qry); $x = $poix/$width; $y = $poiy/$height; $src_rect_xoffset = ($width - $src_rect_width)*$x*intval($forcefill); $src_rect_yoffset = ($height - $src_rect_height)*$y*intval($forcefill); }else{*/ $src_rect_xoffset = ($width - $src_rect_width)/2*intval($forcefill); $src_rect_yoffset = ($height - $src_rect_height)/2*intval($forcefill); //} imagecopyresampled($resizedimg, $newimg, 0, 0, $src_rect_xoffset, $src_rect_yoffset, $th_width, $th_height, $src_rect_width, $src_rect_height); imagedestroy($newimg); if(isset($_GET['nocache'])){ header('content-type: image/png'); imagepng($resizedimg); }else{ imagepng($resizedimg,'images/cache/'.$md5str.'.png'); header('Location: /images/cache/'.$md5str.'.png'); } ?>