ImageInformationGD Class Reference
Implements IImageInformation for GD lib. More...
Public Member Functions |
|
| __construct ($handle, $imagetype) | |
| __destruct () | |
| get_binary_data () | |
| Returns raw image data. |
|
| get_extension () | |
| Returns image file extension (without dot).
|
|
| get_height () | |
| Returns height in pixel. |
|
| get_mime_type () | |
| Returns image mime type. |
|
| get_width () | |
| Returns width in pixel. |
|
| save_to_file ($file, $add_extension=true) | |
| Saves to given file. |
|
Public Attributes |
|
| $handle | |
| $type | |
Detailed Description
Implements IImageInformation for GD lib.
Definition at line 157 of file imagetools.gd.cls.php.
Constructor & Destructor Documentation
| ImageInformationGD::__construct | ( | $ | handle, | |
| $ | imagetype | |||
| ) |
Definition at line 161 of file imagetools.gd.cls.php.
00161 { 00162 $this->handle = $handle; 00163 $this->type = $imagetype; 00164 }
| ImageInformationGD::__destruct | ( | ) |
Definition at line 166 of file imagetools.gd.cls.php.
Member Function Documentation
| ImageInformationGD::get_binary_data | ( | ) |
Returns raw image data.
- Returns:
- string
Implements IImageInformation.
Definition at line 190 of file imagetools.gd.cls.php.
00190 { 00191 $ret = false; 00192 $tmp = tempnam(Config::get_value(Config::TEMP_DIR), 'imgo'); 00193 if ($this->save_to_file($tmp, false)) { 00194 $ret = file_get_contents($tmp); 00195 } 00196 unlink($tmp); 00197 return $ret; 00198 }
| ImageInformationGD::get_extension | ( | ) |
Returns image file extension (without dot).
- Returns:
- int
Implements IImageInformation.
Definition at line 235 of file imagetools.gd.cls.php.
| ImageInformationGD::get_height | ( | ) |
Returns height in pixel.
- Returns:
- int
Implements IImageInformation.
Definition at line 174 of file imagetools.gd.cls.php.
| ImageInformationGD::get_mime_type | ( | ) |
Returns image mime type.
- Returns:
- string
Implements IImageInformation.
Definition at line 227 of file imagetools.gd.cls.php.
| ImageInformationGD::get_width | ( | ) |
Returns width in pixel.
- Returns:
- int
Implements IImageInformation.
Definition at line 182 of file imagetools.gd.cls.php.
| ImageInformationGD::save_to_file | ( | $ | file, | |
| $ | add_extension =
true |
|||
| ) |
Saves to given file.
- Returns:
- bool
Implements IImageInformation.
Definition at line 204 of file imagetools.gd.cls.php.
00204 { 00205 $ret = false; 00206 if ($add_extension) { 00207 $file .= '.' . $this->get_extension(); 00208 } 00209 switch ($this->type) { 00210 case IMAGETYPE_JPEG: 00211 $ret = imagejpeg($this->handle, $file); 00212 break; 00213 case IMAGETYPE_PNG: 00214 $ret = imagepng($this->handle, $file); 00215 break; 00216 case IMAGETYPE_GIF: 00217 $ret = imagegif($this->handle, $file); 00218 break; 00219 } 00220 return $ret; 00221 }
Member Data Documentation
| ImageInformationGD::$handle |
Definition at line 158 of file imagetools.gd.cls.php.
| ImageInformationGD::$type |
Definition at line 159 of file imagetools.gd.cls.php.
The documentation for this class was generated from the following file:
- contributions/lib.imagetools/lib/components/imagetools_impl/imagetools.gd.cls.php
