diff --git a/README.md b/README.md index 94a1b02..5ec586f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ When the HTML form is submitted, the server-side PHP code can validate and uploa 'extension' => $file->getExtension(), 'mime' => $file->getMimetype(), 'size' => $file->getSize(), - 'md5' => $file->getMd5() + 'md5' => $file->getMd5(), + 'dimensions' => $file->getDimensions() ); // Try to upload file diff --git a/src/Upload/File.php b/src/Upload/File.php index 0d04368..92b3fba 100644 --- a/src/Upload/File.php +++ b/src/Upload/File.php @@ -219,6 +219,19 @@ public function getMd5() return md5_file($this->getPathname()); } + /** + * Get image dimensions + * @return array formatted array of dimensions + */ + public function getDimensions() + { + list($width, $height) = getimagesize($this->getPathname()); + return array( + 'width' => $width, + 'height' => $height + ); + } + /******************************************************************************** * Validate *******************************************************************************/