## Apache Zeta Components Manual :: File Source for save_options.php

## Source for file save_options.php

Documentation is available at save_options.php

1. <?php
2. /**
3. * This file contains the ezcImageGdHandler class.
4. *
5. * Licensed to the Apache Software Foundation (ASF) under one
6. * or more contributor license agreements. See the NOTICE file
7. * distributed with this work for additional information
8. * regarding copyright ownership. The ASF licenses this file
9. * to you under the Apache License, Version 2.0 (the
10. * "License"); you may not use this file except in compliance
11. * with the License. You may obtain a copy of the License at
12. *
13. * http://www.apache.org/licenses/LICENSE-2.0
14. *
15. * Unless required by applicable law or agreed to in writing,
16. * software distributed under the License is distributed on an
17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18. * KIND, either express or implied. See the License for the
19. * specific language governing permissions and limitations
20. * under the License.
21. *
22. * @package ImageConversion
23. * @version //autogentag//
24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
25. * @filesource
26. * @access public
27. */
29. /**
30. * Options class for ezcImageHandler->save() methods.
31. *
32. * @property int $compression
33. * The compression level to use, if compression is supported by the
34. * target format (e.g. TIFF). A value between 0 and 9 (incl.) is
35. * expected.
36. * @property int $quality A quality indicator used to determine the quality of
37. * the target image, if supported by the target format (e.g. JPEG). A
38. * value between 0 and 100 (incl.) is expected.
39. * @property array(int) $transparencyReplacementColor
40. * Only certain image formats support transparent backgrounds (e.g.
41. * GIF and PNG). If such images are converted to a format that does
42. * not support transparency, this color will be used as the new
43. * background. The color value is given as an array of integers, each
44. * representing a color value in RGB between 0 and 255.
45. * <code>array( 255, 0, 0 )</code> for example would be pure red.
46. *
47. * @package ImageConversion
48. * @version //autogen//
49. */
50. class ezcImageSaveOptions extends ezcBaseOptions
51. {
52. /**
53. * Properties.
54. *
55. * @var array(string=>mixed)
56. */
57. protected $properties = array(
58. "compression" => null,
59. "quality" => null,
60. "transparencyReplacementColor" => null,
61. );
63. /**
64. * Property set access.
65. *
66. * @param string $propertyName
67. * @param string $propertyValue
68. * @ignore
69. * @return void
70. */
71. public function __set( $propertyName, $propertyValue )
72. {
73. switch ( $propertyName )
74. {
75. case "compression":
76. if ( ( ! is_int ( $propertyValue ) || $propertyValue < 0 || $propertyValue > 9 ) && $propertyValue !== null )
77. {
78. throw new ezcBaseValueException ( $propertyName, $propertyValue, "int > 0 and < 10" );
79. }
80. break;
81. case "quality":
82. if ( ( ! is_int ( $propertyValue ) || $propertyValue < 0 || $propertyValue > 100 ) && $propertyValue !== null )
83. {
84. throw new ezcBaseValueException ( $propertyName, $propertyValue, "int > 0 and <= 100" );
85. }
86. break;
87. case "transparencyReplacementColor":
88. if ( ( ! is_array ( $propertyValue ) || count ( $propertyValue ) < 3 || !isset( $propertyValue[0] ) || !isset( $propertyValue[1] ) || !isset( $propertyValue[2] ) ) && $propertyValue !== null )
89. {
90. throw new ezcBaseValueException ( $propertyName, $propertyValue, "array(int)" );
91. }
92. break;
93. default:
94. throw new ezcBasePropertyNotFoundException ( $propertyName );
95. }
96. $this-> properties [$propertyName] = $propertyValue;
97. }
98. }
100. ?>

Documentation generated by phpDocumentor 1.4.3