GD_Adapter

Image rendering interface.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/include/gd_adapter.cls.php  
  1. class GD_Adapter implements Canvas { 
  2. /** 
  3. * @var DOMPDF 
  4. */ 
  5. private $_dompdf; 
  6.  
  7. /** 
  8. * Resource handle for the image 
  9. * @var resource 
  10. */ 
  11. private $_img; 
  12.  
  13. /** 
  14. * Image width in pixels 
  15. * @var int 
  16. */ 
  17. private $_width; 
  18.  
  19. /** 
  20. * Image height in pixels 
  21. * @var int 
  22. */ 
  23. private $_height; 
  24.  
  25. /** 
  26. * Current page number 
  27. * @var int 
  28. */ 
  29. private $_page_number; 
  30.  
  31. /** 
  32. * Total number of pages 
  33. * @var int 
  34. */ 
  35. private $_page_count; 
  36.  
  37. /** 
  38. * Image antialias factor 
  39. * @var float 
  40. */ 
  41. private $_aa_factor; 
  42.  
  43. /** 
  44. * Allocated colors 
  45. * @var array 
  46. */ 
  47. private $_colors; 
  48.  
  49. /** 
  50. * Background color 
  51. * @var int 
  52. */ 
  53. private $_bg_color; 
  54.  
  55. /** 
  56. * Class constructor 
  57. * @param mixed $size The size of image to create: array(x1, y1, x2, y2) or "letter", "legal", etc. 
  58. * @param string $orientation The orientation of the document (either 'landscape' or 'portrait') 
  59. * @param DOMPDF $dompdf 
  60. * @param float $aa_factor Anti-aliasing factor, 1 for no AA 
  61. * @param array $bg_color Image background color: array(r, g, b, a), 0 <= r, g, b, a <= 1 
  62. */ 
  63. function __construct($size, $orientation = "portrait", DOMPDF $dompdf, $aa_factor = 1.0, $bg_color = array(1, 1, 1, 0) ) { 
  64.  
  65. if ( !is_array($size) ) { 
  66. $size = strtolower($size); 
  67.  
  68. if ( isset(CPDF_Adapter::$PAPER_SIZES[$size]) ) { 
  69. $size = CPDF_Adapter::$PAPER_SIZES[$size]; 
  70. else { 
  71. $size = CPDF_Adapter::$PAPER_SIZES["letter"]; 
  72.  
  73. if ( strtolower($orientation) === "landscape" ) { 
  74. list($size[2], $size[3]) = array($size[3], $size[2]); 
  75.  
  76. $this->_dompdf = $dompdf; 
  77.  
  78. if ( $aa_factor < 1 ) { 
  79. $aa_factor = 1; 
  80.  
  81. $this->_aa_factor = $aa_factor; 
  82.  
  83. $size[2] *= $aa_factor; 
  84. $size[3] *= $aa_factor; 
  85.  
  86. $this->_width = $size[2] - $size[0]; 
  87. $this->_height = $size[3] - $size[1]; 
  88.  
  89. $this->_img = imagecreatetruecolor($this->_width, $this->_height); 
  90.  
  91. if ( is_null($bg_color) || !is_array($bg_color) ) { 
  92. // Pure white bg 
  93. $bg_color = array(1, 1, 1, 0); 
  94.  
  95. $this->_bg_color = $this->_allocate_color($bg_color); 
  96. imagealphablending($this->_img, true); 
  97. imagesavealpha($this->_img, true); 
  98. imagefill($this->_img, 0, 0, $this->_bg_color); 
  99.  
  100.  
  101. function get_dompdf() { 
  102. return $this->_dompdf; 
  103.  
  104. /** 
  105. * Return the GF image resource 
  106. * @return resource 
  107. */ 
  108. function get_image() { return $this->_img; } 
  109.  
  110. /** 
  111. * Return the image's width in pixels 
  112. * @return float 
  113. */ 
  114. function get_width() { return $this->_width / $this->_aa_factor; } 
  115.  
  116. /** 
  117. * Return the image's height in pixels 
  118. * @return float 
  119. */ 
  120. function get_height() { return $this->_height / $this->_aa_factor; } 
  121.  
  122. /** 
  123. * Returns the current page number 
  124. * @return int 
  125. */ 
  126. function get_page_number() { return $this->_page_number; } 
  127.  
  128. /** 
  129. * Returns the total number of pages in the document 
  130. * @return int 
  131. */ 
  132. function get_page_count() { return $this->_page_count; } 
  133.  
  134. /** 
  135. * Sets the current page number 
  136. * @param int $num 
  137. */ 
  138. function set_page_number($num) { $this->_page_number = $num; } 
  139.  
  140. /** 
  141. * Sets the page count 
  142. * @param int $count 
  143. */ 
  144. function set_page_count($count) { $this->_page_count = $count; } 
  145.  
  146. /** 
  147. * Sets the opacity  
  148. *  
  149. * @param $opacity 
  150. * @param $mode 
  151. */ 
  152. function set_opacity($opacity, $mode = "Normal") { 
  153. // FIXME 
  154.  
  155. /** 
  156. * Allocate a new color. Allocate with GD as needed and store 
  157. * previously allocated colors in $this->_colors. 
  158. * @param array $color The new current color 
  159. * @return int The allocated color 
  160. */ 
  161. private function _allocate_color($color) { 
  162.  
  163. if ( isset($color["c"]) ) { 
  164. $color = cmyk_to_rgb($color); 
  165.  
  166. // Full opacity if no alpha set 
  167. if ( !isset($color[3]) )  
  168. $color[3] = 0; 
  169.  
  170. list($r, $g, $b, $a) = $color; 
  171.  
  172. $r *= 255; 
  173. $g *= 255; 
  174. $b *= 255; 
  175. $a *= 127; 
  176.  
  177. // Clip values 
  178. $r = $r > 255 ? 255 : $r; 
  179. $g = $g > 255 ? 255 : $g; 
  180. $b = $b > 255 ? 255 : $b; 
  181. $a = $a > 127 ? 127 : $a; 
  182.  
  183. $r = $r < 0 ? 0 : $r; 
  184. $g = $g < 0 ? 0 : $g; 
  185. $b = $b < 0 ? 0 : $b; 
  186. $a = $a < 0 ? 0 : $a; 
  187.  
  188. $key = sprintf("#%02X%02X%02X%02X", $r, $g, $b, $a); 
  189.  
  190. if ( isset($this->_colors[$key]) ) 
  191. return $this->_colors[$key]; 
  192.  
  193. if ( $a != 0 )  
  194. $this->_colors[$key] = imagecolorallocatealpha($this->_img, $r, $g, $b, $a); 
  195. else 
  196. $this->_colors[$key] = imagecolorallocate($this->_img, $r, $g, $b); 
  197.  
  198. return $this->_colors[$key]; 
  199.  
  200.  
  201. /** 
  202. * Draws a line from x1, y1 to x2, y2 
  203. * See {@link Style::munge_color()} for the format of the color array. 
  204. * See {@link Cpdf::setLineStyle()} for a description of the format of the 
  205. * $style parameter (aka dash). 
  206. * @param float $x1 
  207. * @param float $y1 
  208. * @param float $x2 
  209. * @param float $y2 
  210. * @param array $color 
  211. * @param float $width 
  212. * @param array $style 
  213. */ 
  214. function line($x1, $y1, $x2, $y2, $color, $width, $style = null) { 
  215.  
  216. // Scale by the AA factor 
  217. $x1 *= $this->_aa_factor; 
  218. $y1 *= $this->_aa_factor; 
  219. $x2 *= $this->_aa_factor; 
  220. $y2 *= $this->_aa_factor; 
  221. $width *= $this->_aa_factor; 
  222.  
  223. $c = $this->_allocate_color($color); 
  224.  
  225. // Convert the style array if required 
  226. if ( !is_null($style) ) { 
  227. $gd_style = array(); 
  228.  
  229. if ( count($style) == 1 ) { 
  230. for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) { 
  231. $gd_style[] = $c; 
  232.  
  233. for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++) { 
  234. $gd_style[] = $this->_bg_color; 
  235.  
  236. } else { 
  237.  
  238. $i = 0; 
  239. foreach ($style as $length) { 
  240.  
  241. if ( $i % 2 == 0 ) { 
  242. // 'On' pattern 
  243. for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++)  
  244. $gd_style[] = $c; 
  245.  
  246. } else { 
  247. // Off pattern 
  248. for ($i = 0; $i < $style[0] * $this->_aa_factor; $i++)  
  249. $gd_style[] = $this->_bg_color; 
  250.  
  251. $i++; 
  252.  
  253. imagesetstyle($this->_img, $gd_style); 
  254. $c = IMG_COLOR_STYLED; 
  255.  
  256. imagesetthickness($this->_img, $width); 
  257.  
  258. imageline($this->_img, $x1, $y1, $x2, $y2, $c); 
  259.  
  260.  
  261. function arc($x1, $y1, $r1, $r2, $astart, $aend, $color, $width, $style = array()) { 
  262. // @todo 
  263.  
  264. /** 
  265. * Draws a rectangle at x1, y1 with width w and height h 
  266. * See {@link Style::munge_color()} for the format of the color array. 
  267. * See {@link Cpdf::setLineStyle()} for a description of the $style 
  268. * parameter (aka dash) 
  269. * @param float $x1 
  270. * @param float $y1 
  271. * @param float $w 
  272. * @param float $h 
  273. * @param array $color 
  274. * @param float $width 
  275. * @param array $style 
  276. */  
  277. function rectangle($x1, $y1, $w, $h, $color, $width, $style = null) { 
  278.  
  279. // Scale by the AA factor 
  280. $x1 *= $this->_aa_factor; 
  281. $y1 *= $this->_aa_factor; 
  282. $w *= $this->_aa_factor; 
  283. $h *= $this->_aa_factor; 
  284.  
  285. $c = $this->_allocate_color($color); 
  286.  
  287. // Convert the style array if required 
  288. if ( !is_null($style) ) { 
  289. $gd_style = array(); 
  290.  
  291. foreach ($style as $length) { 
  292. for ($i = 0; $i < $length; $i++) { 
  293. $gd_style[] = $c; 
  294.  
  295. imagesetstyle($this->_img, $gd_style); 
  296. $c = IMG_COLOR_STYLED; 
  297.  
  298. imagesetthickness($this->_img, $width); 
  299.  
  300. imagerectangle($this->_img, $x1, $y1, $x1 + $w, $y1 + $h, $c); 
  301.  
  302.  
  303. /** 
  304. * Draws a filled rectangle at x1, y1 with width w and height h 
  305. * See {@link Style::munge_color()} for the format of the color array. 
  306. * @param float $x1 
  307. * @param float $y1 
  308. * @param float $w 
  309. * @param float $h 
  310. * @param array $color 
  311. */  
  312. function filled_rectangle($x1, $y1, $w, $h, $color) { 
  313.  
  314. // Scale by the AA factor 
  315. $x1 *= $this->_aa_factor; 
  316. $y1 *= $this->_aa_factor; 
  317. $w *= $this->_aa_factor; 
  318. $h *= $this->_aa_factor; 
  319.  
  320. $c = $this->_allocate_color($color); 
  321.  
  322. imagefilledrectangle($this->_img, $x1, $y1, $x1 + $w, $y1 + $h, $c); 
  323.  
  324.  
  325. /** 
  326. * Starts a clipping rectangle at x1, y1 with width w and height h 
  327. * @param float $x1 
  328. * @param float $y1 
  329. * @param float $w 
  330. * @param float $h 
  331. */ 
  332. function clipping_rectangle($x1, $y1, $w, $h) { 
  333. // @todo 
  334.  
  335. function clipping_roundrectangle($x1, $y1, $w, $h, $rTL, $rTR, $rBR, $rBL) { 
  336. // @todo 
  337.  
  338. /** 
  339. * Ends the last clipping shape 
  340. */  
  341. function clipping_end() { 
  342. // @todo 
  343.  
  344. function save() { 
  345. // @todo 
  346.  
  347. function restore() { 
  348. // @todo 
  349.  
  350. function rotate($angle, $x, $y) { 
  351. // @todo 
  352.  
  353. function skew($angle_x, $angle_y, $x, $y) { 
  354. // @todo 
  355.  
  356. function scale($s_x, $s_y, $x, $y) { 
  357. // @todo 
  358.  
  359. function translate($t_x, $t_y) { 
  360. // @todo 
  361.  
  362. function transform($a, $b, $c, $d, $e, $f) { 
  363. // @todo 
  364.  
  365. /** 
  366. * Draws a polygon 
  367. * The polygon is formed by joining all the points stored in the $points 
  368. * array. $points has the following structure: 
  369. * <code> 
  370. * array(0 => x1,  
  371. * 1 => y1,  
  372. * 2 => x2,  
  373. * 3 => y2,  
  374. * ... 
  375. * ); 
  376. * </code> 
  377. * See {@link Style::munge_color()} for the format of the color array. 
  378. * See {@link Cpdf::setLineStyle()} for a description of the $style 
  379. * parameter (aka dash)  
  380. * @param array $points 
  381. * @param array $color 
  382. * @param float $width 
  383. * @param array $style 
  384. * @param bool $fill Fills the polygon if true 
  385. */ 
  386. function polygon($points, $color, $width = null, $style = null, $fill = false) { 
  387.  
  388. // Scale each point by the AA factor 
  389. foreach (array_keys($points) as $i) 
  390. $points[$i] *= $this->_aa_factor; 
  391.  
  392. $c = $this->_allocate_color($color); 
  393.  
  394. // Convert the style array if required 
  395. if ( !is_null($style) && !$fill ) { 
  396. $gd_style = array(); 
  397.  
  398. foreach ($style as $length) { 
  399. for ($i = 0; $i < $length; $i++) { 
  400. $gd_style[] = $c; 
  401.  
  402. imagesetstyle($this->_img, $gd_style); 
  403. $c = IMG_COLOR_STYLED; 
  404.  
  405. imagesetthickness($this->_img, $width); 
  406.  
  407. if ( $fill )  
  408. imagefilledpolygon($this->_img, $points, count($points) / 2, $c); 
  409. else 
  410. imagepolygon($this->_img, $points, count($points) / 2, $c); 
  411.  
  412.  
  413. /** 
  414. * Draws a circle at $x, $y with radius $r 
  415. * See {@link Style::munge_color()} for the format of the color array. 
  416. * See {@link Cpdf::setLineStyle()} for a description of the $style 
  417. * parameter (aka dash) 
  418. * @param float $x 
  419. * @param float $y 
  420. * @param float $r 
  421. * @param array $color 
  422. * @param float $width 
  423. * @param array $style 
  424. * @param bool $fill Fills the circle if true  
  425. */  
  426. function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false) { 
  427.  
  428. // Scale by the AA factor 
  429. $x *= $this->_aa_factor; 
  430. $y *= $this->_aa_factor; 
  431. $r *= $this->_aa_factor; 
  432.  
  433. $c = $this->_allocate_color($color); 
  434.  
  435. // Convert the style array if required 
  436. if ( !is_null($style) && !$fill ) { 
  437. $gd_style = array(); 
  438.  
  439. foreach ($style as $length) { 
  440. for ($i = 0; $i < $length; $i++) { 
  441. $gd_style[] = $c; 
  442.  
  443. imagesetstyle($this->_img, $gd_style); 
  444. $c = IMG_COLOR_STYLED; 
  445.  
  446. imagesetthickness($this->_img, $width); 
  447.  
  448. if ( $fill ) 
  449. imagefilledellipse($this->_img, $x, $y, $r, $r, $c); 
  450. else 
  451. imageellipse($this->_img, $x, $y, $r, $r, $c); 
  452.  
  453.  
  454. /** 
  455. * Add an image to the pdf. 
  456. * The image is placed at the specified x and y coordinates with the 
  457. * given width and height. 
  458. * @param string $img_url the path to the image 
  459. * @param float $x x position 
  460. * @param float $y y position 
  461. * @param int $w width (in pixels) 
  462. * @param int $h height (in pixels) 
  463. * @param string $resolution 
  464. * @return void 
  465. * @internal param string $img_type the type (e.g. extension) of the image 
  466. */ 
  467. function image($img_url, $x, $y, $w, $h, $resolution = "normal") { 
  468. $img_type = Image_Cache::detect_type($img_url); 
  469. $img_ext = Image_Cache::type_to_ext($img_type); 
  470.  
  471. if ( !$img_ext ) { 
  472. return; 
  473.  
  474. $func = "imagecreatefrom$img_ext"; 
  475. $src = @$func($img_url); 
  476.  
  477. if ( !$src ) { 
  478. return; // Probably should add to $_dompdf_errors or whatever here 
  479.  
  480. // Scale by the AA factor 
  481. $x *= $this->_aa_factor; 
  482. $y *= $this->_aa_factor; 
  483.  
  484. $w *= $this->_aa_factor; 
  485. $h *= $this->_aa_factor; 
  486.  
  487. $img_w = imagesx($src); 
  488. $img_h = imagesy($src); 
  489.  
  490. imagecopyresampled($this->_img, $src, $x, $y, 0, 0, $w, $h, $img_w, $img_h); 
  491.  
  492.  
  493. /** 
  494. * Writes text at the specified x and y coordinates 
  495. * See {@link Style::munge_color()} for the format of the color array. 
  496. * @param float $x 
  497. * @param float $y 
  498. * @param string $text the text to write 
  499. * @param string $font the font file to use 
  500. * @param float $size the font size, in points 
  501. * @param array $color 
  502. * @param float $word_spacing word spacing adjustment 
  503. * @param float $char_spacing 
  504. * @param float $angle Text angle 
  505. * @return void 
  506. */ 
  507. function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $word_spacing = 0.0, $char_spacing = 0.0, $angle = 0.0) { 
  508.  
  509. // Scale by the AA factor 
  510. $x *= $this->_aa_factor; 
  511. $y *= $this->_aa_factor; 
  512. $size *= $this->_aa_factor; 
  513.  
  514. $h = $this->get_font_height($font, $size); 
  515. $c = $this->_allocate_color($color); 
  516.  
  517. $text = mb_encode_numericentity($text, array(0x0080, 0xff, 0, 0xff), 'UTF-8'); 
  518.  
  519. $font = $this->get_ttf_file($font); 
  520.  
  521. // FIXME: word spacing 
  522. @imagettftext($this->_img, $size, $angle, $x, $y + $h, $c, $font, $text); 
  523.  
  524.  
  525. function javascript($code) { 
  526. // Not implemented 
  527.  
  528. /** 
  529. * Add a named destination (similar to <a name="foo">...</a> in html) 
  530. * @param string $anchorname The name of the named destination 
  531. */ 
  532. function add_named_dest($anchorname) { 
  533. // Not implemented 
  534.  
  535. /** 
  536. * Add a link to the pdf 
  537. * @param string $url The url to link to 
  538. * @param float $x The x position of the link 
  539. * @param float $y The y position of the link 
  540. * @param float $width The width of the link 
  541. * @param float $height The height of the link 
  542. */ 
  543. function add_link($url, $x, $y, $width, $height) { 
  544. // Not implemented 
  545.  
  546. /** 
  547. * Add meta information to the PDF 
  548. * @param string $label label of the value (Creator, Producer, etc.) 
  549. * @param string $value the text to set 
  550. */ 
  551. function add_info($label, $value) { 
  552. // N/A 
  553.  
  554. function set_default_view($view, $options = array()) { 
  555. // N/A 
  556.  
  557. /** 
  558. * Calculates text size, in points 
  559. * @param string $text the text to be sized 
  560. * @param string $font the desired font 
  561. * @param float $size the desired font size 
  562. * @param float $word_spacing word spacing, if any 
  563. * @param float $char_spacing char spacing, if any 
  564. * @return float 
  565. */ 
  566. function get_text_width($text, $font, $size, $word_spacing = 0.0, $char_spacing = 0.0) { 
  567. $font = $this->get_ttf_file($font); 
  568.  
  569. $text = mb_encode_numericentity($text, array(0x0080, 0xffff, 0, 0xffff), 'UTF-8'); 
  570.  
  571. // FIXME: word spacing 
  572. list($x1, , $x2) = @imagettfbbox($size, 0, $font, $text); 
  573. return $x2 - $x1; 
  574.  
  575. function get_ttf_file($font) { 
  576. if ( strpos($font, '.ttf') === false ) 
  577. $font .= ".ttf"; 
  578.  
  579. /**$filename = substr(strtolower(basename($font)), 0, -4); 
  580.  
  581. if ( in_array($filename, DOMPDF::$native_fonts) ) { 
  582. return "arial.ttf"; 
  583. }*/ 
  584.  
  585. return $font; 
  586.  
  587. /** 
  588. * Calculates font height, in points 
  589. * @param string $font 
  590. * @param float $size 
  591. * @return float 
  592. */ 
  593. function get_font_height($font, $size) { 
  594. $font = $this->get_ttf_file($font); 
  595. $ratio = $this->_dompdf->get_option("font_height_ratio"); 
  596.  
  597. // FIXME: word spacing 
  598. list(, $y2, , , , $y1) = imagettfbbox($size, 0, $font, "MXjpqytfhl"); // Test string with ascenders, descenders and caps 
  599. return ($y2 - $y1) * $ratio; 
  600.  
  601. function get_font_baseline($font, $size) { 
  602. $ratio = $this->_dompdf->get_option("font_height_ratio"); 
  603. return $this->get_font_height($font, $size) / $ratio; 
  604.  
  605. /** 
  606. * Starts a new page 
  607. * Subsequent drawing operations will appear on the new page. 
  608. */ 
  609. function new_page() { 
  610. $this->_page_number++; 
  611. $this->_page_count++; 
  612. }  
  613.  
  614. function open_object() { 
  615. // N/A 
  616.  
  617. function close_object() { 
  618. // N/A 
  619.  
  620. function add_object() { 
  621. // N/A 
  622.  
  623. function page_text() { 
  624. // N/A 
  625.  
  626. /** 
  627. * Streams the image directly to the browser 
  628. * @param string $filename the name of the image file (ignored) 
  629. * @param array $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only) 
  630. */ 
  631. function stream($filename, $options = null) { 
  632.  
  633. // Perform any antialiasing 
  634. if ( $this->_aa_factor != 1 ) { 
  635. $dst_w = $this->_width / $this->_aa_factor; 
  636. $dst_h = $this->_height / $this->_aa_factor; 
  637. $dst = imagecreatetruecolor($dst_w, $dst_h); 
  638. imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,  
  639. $dst_w, $dst_h,  
  640. $this->_width, $this->_height); 
  641. } else { 
  642. $dst = $this->_img; 
  643.  
  644. if ( !isset($options["type"]) ) 
  645. $options["type"] = "png"; 
  646.  
  647. $type = strtolower($options["type"]); 
  648.  
  649. header("Cache-Control: private"); 
  650.  
  651. switch ($type) { 
  652.  
  653. case "jpg": 
  654. case "jpeg": 
  655. if ( !isset($options["quality"]) ) 
  656. $options["quality"] = 75; 
  657.  
  658. header("Content-type: image/jpeg"); 
  659. imagejpeg($dst, '', $options["quality"]); 
  660. break; 
  661.  
  662. case "png": 
  663. default: 
  664. header("Content-type: image/png"); 
  665. imagepng($dst); 
  666. break; 
  667.  
  668. if ( $this->_aa_factor != 1 )  
  669. imagedestroy($dst); 
  670.  
  671. /** 
  672. * Returns the PNG as a string 
  673. * @param array $options associative array, 'type' => jpeg|jpg|png, 'quality' => 0 - 100 (jpeg only) 
  674. * @return string 
  675. */ 
  676. function output($options = null) { 
  677.  
  678. if ( $this->_aa_factor != 1 ) { 
  679. $dst_w = $this->_width / $this->_aa_factor; 
  680. $dst_h = $this->_height / $this->_aa_factor; 
  681. $dst = imagecreatetruecolor($dst_w, $dst_h); 
  682. imagecopyresampled($dst, $this->_img, 0, 0, 0, 0,  
  683. $dst_w, $dst_h,  
  684. $this->_width, $this->_height); 
  685. } else { 
  686. $dst = $this->_img; 
  687.  
  688. if ( !isset($options["type"]) ) 
  689. $options["type"] = "png"; 
  690.  
  691. $type = $options["type"]; 
  692.  
  693. ob_start(); 
  694.  
  695. switch ($type) { 
  696.  
  697. case "jpg": 
  698. case "jpeg": 
  699. if ( !isset($options["quality"]) ) 
  700. $options["quality"] = 75; 
  701.  
  702. imagejpeg($dst, '', $options["quality"]); 
  703. break; 
  704.  
  705. case "png": 
  706. default: 
  707. imagepng($dst); 
  708. break; 
  709.  
  710. $image = ob_get_clean(); 
  711.  
  712. if ( $this->_aa_factor != 1 ) 
  713. imagedestroy($dst); 
  714.  
  715. return $image; 
  716.  
  717.