Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from scottymeuk/master
Browse files Browse the repository at this point in the history
Add support for image dimensions
  • Loading branch information
Josh Lockhart committed Jul 7, 2013
2 parents 4524dad + fcc70a0 commit 6a9e5e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/Upload/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*******************************************************************************/
Expand Down

1 comment on commit 6a9e5e1

@372s
Copy link

@372s 372s commented on 6a9e5e1 Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My english is not good.
It`s not the lastest tag.
Would you like to add the latest tag?

Please sign in to comment.