Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cHTML
  • cHTMLAlignmentTable
  • cHTMLArticle
  • cHTMLAside
  • cHTMLAudio
  • cHTMLButton
  • cHTMLCanvas
  • cHTMLCheckbox
  • cHTMLContentElement
  • cHTMLDiv
  • cHTMLFieldset
  • cHTMLFooter
  • cHTMLForm
  • cHTMLFormElement
  • cHTMLHeader
  • cHTMLHgroup
  • cHTMLHiddenField
  • cHTMLIFrame
  • cHTMLImage
  • cHTMLLabel
  • cHTMLLegend
  • cHTMLLink
  • cHTMLList
  • cHTMLListItem
  • cHTMLNav
  • cHTMLOptgroup
  • cHTMLOptionElement
  • cHTMLParagraph
  • cHTMLPasswordbox
  • cHTMLRadiobutton
  • cHTMLScript
  • cHTMLSection
  • cHTMLSelectElement
  • cHTMLSpan
  • cHTMLTable
  • cHTMLTableBody
  • cHTMLTableData
  • cHTMLTableHead
  • cHTMLTableHeader
  • cHTMLTableRow
  • cHTMLTextarea
  • cHTMLTextbox
  • cHTMLTime
  • cHTMLUpload
  • cHTMLVideo
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * This file contains the cHTMLImage class.
  4:  *
  5:  * @package Core
  6:  * @subpackage GUI_HTML
  7:  * @version SVN Revision $Rev:$
  8:  *
  9:  * @author Simon Sprankel
 10:  * @copyright four for business AG <www.4fb.de>
 11:  * @license http://www.contenido.org/license/LIZENZ.txt
 12:  * @link http://www.4fb.de
 13:  * @link http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: /**
 19:  * cHTMLImage class represents an image.
 20:  *
 21:  * @package Core
 22:  * @subpackage GUI_HTML
 23:  */
 24: class cHTMLImage extends cHTML {
 25: 
 26:     /**
 27:      * Constructor.
 28:      * Creates an HTML IMG element.
 29:      *
 30:      * @param mixed $content String or object with the contents
 31:      * @param string $class the class of this element
 32:      */
 33:     public function __construct($src = NULL, $class = '') {
 34:         parent::__construct();
 35: 
 36:         $this->_tag = 'img';
 37:         $this->_contentlessTag = true;
 38: 
 39:         $this->setSrc($src);
 40:         $this->setClass($class);
 41:     }
 42: 
 43:     /**
 44:      * Sets the image's source file
 45:      *
 46:      * @param string $src source location
 47:      * @return cHTMLImage $this
 48:      */
 49:     public function setSrc($src) {
 50:         if ($src === NULL) {
 51:             $src = 'images/spacer.gif';
 52:         }
 53: 
 54:         return $this->updateAttribute('src', $src);
 55:     }
 56: 
 57:     /**
 58:      * Sets the image's width
 59:      *
 60:      * @param int $width Image width
 61:      * @return cHTMLImage $this
 62:      */
 63:     public function setWidth($width) {
 64:         return $this->updateAttribute('width', $width);
 65:     }
 66: 
 67:     /**
 68:      * Sets the image's height
 69:      *
 70:      * @param int $height Image height
 71:      * @return cHTMLImage $this
 72:      */
 73:     public function setHeight($height) {
 74:         return $this->updateAttribute('height', $height);
 75:     }
 76: 
 77:     /**
 78:      * Sets the border size
 79:      *
 80:      * @param int $border Border size
 81:      * @return cHTMLImage $this
 82:      */
 83:     public function setBorder($border) {
 84:         return $this->updateAttribute('border', $border);
 85:     }
 86: 
 87:     /**
 88:      * Apply dimensions from the source image
 89:      */
 90:     public function applyDimensions() {
 91:         // Try to open the image
 92:         list($width, $height) = @getimagesize(cRegistry::getBackendPath() . $this->getAttribute('src'));
 93: 
 94:         if (!empty($width) && !empty($height)) {
 95:             $this->setWidth($width);
 96:             $this->setHeight($height);
 97:         }
 98:     }
 99: 
100: }
101: 
CMS CONTENIDO 4.9.5 API documentation generated by ApiGen 2.8.0