Horde_Image_Base::getDimensions PHP Method

getDimensions() public method

Returns the height and width of the current image data.
public getDimensions ( ) : array
return array An hash with 'width' containing the width, 'height' containing the height of the image.
    public function getDimensions()
    {
        // Check if we know it already
        if ($this->_width == 0 && $this->_height == 0) {
            $tmp = $this->toFile();
            $details = @getimagesize($tmp);
            list($this->_width, $this->_height) = $details;
            unlink($tmp);
        }
        return array('width' => $this->_width, 'height' => $this->_height);
    }

Usage Example

Example #1
0
 /**
  * Returns the dimensions of the given view.
  *
  * @param string $view  The view (full, screen etc..) to get dimensions for
  *
  * @return array  A hash of 'width and 'height' dimensions.
  */
 public function getDimensions($view = 'full')
 {
     $this->load($view);
     return $this->_image->getDimensions();
 }