properties['imageFormat'] = IMG_PNG; $this->properties['jpegQuality'] = 70; $this->properties['detail'] = 1; $this->properties['shadeCircularArc'] = .5; $this->properties['supersampling'] = 2; $this->properties['background'] = false; $this->properties['resampleFunction'] = 'imagecopyresampled'; $this->properties['forceNativeTTF'] = false; $this->properties['imageMapResolution'] = 10; parent::__construct( $options ); } /** * Set an option value * * @param string $propertyName * @param mixed $propertyValue * @throws ezcBasePropertyNotFoundException * If a property is not defined in this class * @return void */ public function __set( $propertyName, $propertyValue ) { switch ( $propertyName ) { case 'imageFormat': if ( imagetypes() & $propertyValue ) { $this->properties['imageFormat'] = (int) $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'Unsupported image type.' ); } break; case 'jpegQuality': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 0 ) || ( $propertyValue > 100 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, '0 <= int <= 100' ); } $this->properties['jpegQuality'] = (int) $propertyValue; break; case 'detail': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 1 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' ); } $this->properties['detail'] = (int) $propertyValue; break; case 'supersampling': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 1 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' ); } $this->properties['supersampling'] = (int) $propertyValue; break; case 'background': if ( $propertyValue === false || ( is_file( $propertyValue ) && is_readable( $propertyValue ) ) ) { $this->properties['background'] = realpath( $propertyValue ); } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'readable file' ); } break; case 'resampleFunction': if ( ezcBaseFeatures::hasFunction( $propertyValue ) ) { $this->properties['resampleFunction'] = $propertyValue; } else { throw new ezcBaseValueException( $propertyName, $propertyValue, 'function' ); } break; case 'forceNativeTTF': if ( !is_bool( $propertyValue ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'bool' ); } $this->properties['forceNativeTTF'] = (bool) $propertyValue; break; case 'imageMapResolution': if ( !is_numeric( $propertyValue ) || ( $propertyValue < 1 ) ) { throw new ezcBaseValueException( $propertyName, $propertyValue, 'int >= 1' ); } $this->properties['imageMapResolution'] = (int) $propertyValue; break; default: parent::__set( $propertyName, $propertyValue ); break; } } } ?>