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
    • NavigationMain
    • 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:      * @return void
 33:      */
 34:     public function __construct($src = null, $class = '') {
 35:         parent::__construct();
 36: 
 37:         $this->_tag = 'img';
 38:         $this->_contentlessTag = true;
 39: 
 40:         $this->setSrc($src);
 41:         $this->setClass($class);
 42:     }
 43: 
 44:     /**
 45:      * Sets the image's source file
 46:      *
 47:      * @param string $src source location
 48:      * @return cHTMLImage $this
 49:      */
 50:     public function setSrc($src) {
 51:         if ($src === null) {
 52:             $src = 'images/spacer.gif';
 53:         }
 54: 
 55:         return $this->updateAttribute('src', $src);
 56:     }
 57: 
 58:     /**
 59:      * Sets the image's width
 60:      *
 61:      * @param int $width Image width
 62:      * @return cHTMLImage $this
 63:      */
 64:     public function setWidth($width) {
 65:         return $this->updateAttribute('width', $width);
 66:     }
 67: 
 68:     /**
 69:      * Sets the image's height
 70:      *
 71:      * @param int $height Image height
 72:      * @return cHTMLImage $this
 73:      */
 74:     public function setHeight($height) {
 75:         return $this->updateAttribute('height', $height);
 76:     }
 77: 
 78:     /**
 79:      * Sets the border size
 80:      *
 81:      * @param int $border Border size
 82:      * @return cHTMLImage $this
 83:      */
 84:     public function setBorder($border) {
 85:         return $this->updateAttribute('border', $border);
 86:     }
 87: 
 88:     /**
 89:      * Apply dimensions from the source image
 90:      */
 91:     public function applyDimensions() {
 92:         // Try to open the image
 93:         list($width, $height) = @getimagesize(cRegistry::getBackendPath() . $this->getAttribute('src'));
 94: 
 95:         if (!empty($width) && !empty($height)) {
 96:             $this->setWidth($width);
 97:             $this->setHeight($height);
 98:         }
 99:     }
100: 
101: }
102: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0