[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Joomla! Content Management System 5 * 6 * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> 7 * @license GNU General Public License version 2 or later; see LICENSE.txt 8 */ 9 10 namespace Joomla\CMS\Document; 11 12 use Joomla\CMS\Factory; 13 14 // phpcs:disable PSR1.Files.SideEffects 15 \defined('JPATH_PLATFORM') or die; 16 // phpcs:enable PSR1.Files.SideEffects 17 18 /** 19 * ImageDocument class, provides an easy interface to output image data 20 * 21 * @since 3.0.0 22 */ 23 class ImageDocument extends Document 24 { 25 /** 26 * Class constructor 27 * 28 * @param array $options Associative array of options 29 * 30 * @since 3.0.0 31 */ 32 public function __construct($options = array()) 33 { 34 parent::__construct($options); 35 36 // Set mime type 37 $this->_mime = 'image/png'; 38 39 // Set document type 40 $this->_type = 'image'; 41 } 42 43 /** 44 * Render the document. 45 * 46 * @param boolean $cache If true, cache the output 47 * @param array $params Associative array of attributes 48 * 49 * @return string The rendered data 50 * 51 * @since 3.0.0 52 */ 53 public function render($cache = false, $params = array()) 54 { 55 // Get the image type 56 $type = Factory::getApplication()->input->get('type', 'png'); 57 58 switch ($type) { 59 case 'jpg': 60 case 'jpeg': 61 $this->_mime = 'image/jpeg'; 62 break; 63 case 'gif': 64 $this->_mime = 'image/gif'; 65 break; 66 case 'png': 67 default: 68 $this->_mime = 'image/png'; 69 break; 70 } 71 72 $this->_charset = null; 73 74 parent::render($cache, $params); 75 76 return $this->getBuffer(); 77 } 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |