4 * XHTML 1.1 Image Module provides basic image embedding.
5 * @note There is specialized code for removing empty images in
6 * HTMLPurifier_Strategy_RemoveForeignElements
8 class HTMLPurifier_HTMLModule_Image extends HTMLPurifier_HTMLModule
14 public $name = 'Image';
17 * @param HTMLPurifier_Config $config
19 public function setup($config)
21 $max = $config->get('HTML.MaxImgLength');
22 $img = $this->addElement(
29 // According to the spec, it's Length, but percents can
30 // be abused, so we allow only Pixels.
31 'height' => 'Pixels#' . $max,
32 'width' => 'Pixels#' . $max,
34 'src*' => new HTMLPurifier_AttrDef_URI(true), // embedded
37 if ($max === null || $config->get('HTML.Trusted')) {
38 $img->attr['height'] =
39 $img->attr['width'] = 'Length';
42 // kind of strange, but splitting things up would be inefficient
43 $img->attr_transform_pre[] =
44 $img->attr_transform_post[] =
45 new HTMLPurifier_AttrTransform_ImgRequired();