1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-27 23:59:50 +02:00

added method documentation

This commit is contained in:
Oliver Vogel
2013-02-24 22:24:59 +01:00
parent 4555cc9b16
commit 27f729001d

View File

@@ -9,54 +9,63 @@ class Image
{ {
/** /**
* The image resource identifier of current image * The image resource identifier of current image
*
* @var resource * @var resource
*/ */
public $resource; public $resource;
/** /**
* Type of current image * Type of current image
*
* @var string * @var string
*/ */
public $type; public $type;
/** /**
* Width of current image * Width of current image
*
* @var integer * @var integer
*/ */
public $width; public $width;
/** /**
* Height of current image * Height of current image
*
* @var integer * @var integer
*/ */
public $height; public $height;
/** /**
* Directory path of current image * Directory path of current image
*
* @var string * @var string
*/ */
public $dirname; public $dirname;
/** /**
* Trailing name component of current image filename * Trailing name component of current image filename
*
* @var string * @var string
*/ */
public $basename; public $basename;
/** /**
* File extension of current image filename * File extension of current image filename
*
* @var string * @var string
*/ */
public $extension; public $extension;
/** /**
* Combined filename (basename and extension) * Combined filename (basename and extension)
*
* @var string * @var string
*/ */
public $filename; public $filename;
/** /**
* Instance of Illuminate\Filesystem\Filesystem * Instance of Illuminate\Filesystem\Filesystem
*
* @var Filesystem * @var Filesystem
*/ */
protected $filesystem; protected $filesystem;
@@ -297,12 +306,14 @@ class Image
/** /**
* Cut out a detail of the image in given ratio and resize to output size * Cut out a detail of the image in given ratio and resize to output size
* *
* @param mixed width|height width and height are optional, the not given * @param int $width
* parameter is calculated based on the given * @param int $height
*
* @return Image * @return Image
*/ */
public function grab($width = null, $height = null) public function grab($width = null, $height = null)
{ {
// catch legacy call
if (is_array($width)) { if (is_array($width)) {
$dimensions = $width; $dimensions = $width;
return $this->legacyGrab($dimensions); return $this->legacyGrab($dimensions);
@@ -339,6 +350,12 @@ class Image
return $this->modify(0, 0, $src_x, $src_y, $width, $height, $grab_width, $grab_height); return $this->modify(0, 0, $src_x, $src_y, $width, $height, $grab_width, $grab_height);
} }
/**
* Legacy Method to support older grab calls
*
* @param array $dimensions
* @return Image
*/
public function legacyGrab($dimensions = array()) public function legacyGrab($dimensions = array())
{ {
$width = array_key_exists('width', $dimensions) ? intval($dimensions['width']) : null; $width = array_key_exists('width', $dimensions) ? intval($dimensions['width']) : null;
@@ -720,6 +737,12 @@ class Image
return $this; return $this;
} }
/**
* Convert rgba alpha (0-1) value to gd value (0-127)
*
* @param float $input
* @return int
*/
private function alpha2gd($input) private function alpha2gd($input)
{ {
$range_input = range(1, 0, 1/127); $range_input = range(1, 0, 1/127);
@@ -732,6 +755,12 @@ class Image
} }
} }
/**
* Convert gd alpha (0-127) value to rgba alpha value (0-1)
*
* @param int $input
* @return float
*/
private function alpha2rgba($input) private function alpha2rgba($input)
{ {
$range_input = range(0, 127); $range_input = range(0, 127);