Glad to see you are compliant ..... however, I have a small problem ....
Your code wishes to issue
public function show ()
{
if (headers_sent())
{
throw new RuntimeException('Cannot show image, headers have already been sent');
}
switch ($this->format)
{
case 'GIF':
header('Content-type: image/gif');
imagegif($this->oldImage);
break;
case 'JPG':
header('Content-type: image/jpeg');
imagejpeg($this->oldImage, null, $this->options['jpegQuality']);
break;
case 'PNG':
header('Content-type: image/png');
imagepng($this->oldImage);
break;
}
return $this;
}
And my Code for XHTML compliance (and various meta-tags) has already issued this little lot at the start of each page ......
$charset = "utf-8";
$mime = "text/html";
# NOTE: To allow for q-values with one space (text/html; q=0.5),
# use the following regex:
# "/text\/html;[\ ]{0,1}q=([0-1]{0,1}\.\d{0,4})/i"
if((isset($_SERVER["HTTP_ACCEPT"])) && (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml"))) {
if(preg_match("/application\/xhtml\+xml;q=([0-1]{0,1}\.\d{0,4})/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
$xhtml_q = $matches[1];
if(preg_match("/text\/html;q=([0-1]{0,1}\.\d{0,4})/i",$_SERVER["HTTP_ACCEPT"],$matches)) {
$html_q = $matches[1];
if((float)$xhtml_q >= (float)$html_q)
$mime = "application/xhtml+xml";
}
}
else
$mime = "application/xhtml+xml";
}
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="<?php echo $mime ?>;charset=<?php echo $charset ?>" />
<!-- The lines below are for CSS - On my sites I have the two classes,
You may only have media, or you may need one for mobile (cell) phones - add / remove as you wish -->
<meta http-equiv="Content-Style-Type" content="text/css" />
<link rel="stylesheet" media="screen" type="text/css" href="/mgjuddltd/html/mgj.css" />
<link rel="stylesheet" media="print" type="text/css" href="/mgjuddltd/html/mgj_print.css" />
<meta name="description" content="hire plant parts, spares engineering services"/>
<meta name="keywords" content="keys, locks, engine, parts, hire, plant, services, engineering,
consumables,"/>
<meta name="copyright" content="M.G. Judd Ltd., 2009. All rights Reserved."/>
<meta name="no-email-collection" content="http://www.unspam.com/noemailcollection" />
</head>
I'm still pretty new to this strict encoding, whilst trying to look after non-xhtml browsers - I'm not too sure how to get around the issuing of a "content-type:" to your specific requirements....
I'm sorta guessing that most browsers can handle
jpgs & gifs - w3c has this to say on the matter....
Attributes of this type identify the allowable content type(s) of an associated URI (usually a value of another attribute on the same element). At its most general, it is a comma-separated list of media ranges with optional accept parameters, as defined in section 14.1 of [RFC2616] as the field value of the accept request header.In its simplest case, this is just a media type, such as "image/png" or "application/xml", but it may also contain asterisks, such as "image/*" or "*/*", or lists of acceptable media types, such as "image/png, image/gif, image/jpeg".
The user agent must combine this list with its own list of acceptable media types by taking the intersection, and then use the resulting list as the field value of the accept request header when requesting the resource using HTTP.
For instance, if the attribute specifies the value "image/png, image/gif, image/jpeg", but the user agent does not accept images of type "image/gif" then the resultant accept header would contain "image/png, image/jpeg".
A user agent must imitate similar behavior when using other methods than HTTP. For instance, when accessing files in a local filestore, <p src="logo" srctype="image/png, image/jpeg"> might cause the user agent first to look for a file logo.png, and then for logo.jpg.
If a value for the content type is not given, "*/*" must be used for its value.
For the current list of registered content types, please consult [MIMETYPES].
So, placing a In its simplest case, this is just a media type, such as "image/png" or "application/xml", but it may also contain asterisks, such as "image/*" or "*/*", or lists of acceptable media types, such as "image/png, image/gif, image/jpeg". type statement would keep me in alignment with the rules - My question then is, what would be, if any, the effect of removing the code from your library with those directives in ?
-- Yeah, I know I'm a pain in the ass, but, please try to see it my way - I already have a header section to look after all my pages, and I would be most pleased to be able to adapt to use your fantastic php-code.
Regards,
Phill.