150 || $height > 120) { $scale = ($width > 150 ? 150 / $width : 120 / $height); $width *= $scale; $height *= $scale; } imagecopyresampled($im, $src, (150-$width)/2, (120-$height)/2, 0, 0, $width, $height, $info[0], $info[1]); } header('Content-type: image/jpeg'); imagejpeg($im, $thumb, 85); } } $last_modified = gmdate('D, d M Y H:i:s', filemtime($thumb)) . ' GMT'; $etag = sprintf('"thumb-%08X-%08X"', $p_id, filemtime($thumb)); if(isset($_SERVER['HTTP_IF_NONE_MATCH'])) { $if_none_match = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']); if($if_none_match == $etag) { header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); exit; } } if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']); if($if_modified_since == $gmdate_mod) { header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified'); exit; } } header("Last-Modified: $last_modified"); header("ETag: $etag"); header('Content-Length: ' . filesize($thumb)); header('Content-type: image/jpeg'); readfile($thumb); exit; ?>