Skip to content

Commit

Permalink
Use the isImage function in the media helper (#153)
Browse files Browse the repository at this point in the history
* Use the isImage function in the media helper

* Check mime type first
  • Loading branch information
laoneo authored and dneukirchen committed Apr 3, 2017
1 parent ae7da39 commit 5f974c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private function getPathInformation($path)
$obj->width = 0;
$obj->height = 0;

if (strpos($obj->mime_type, 'image/') === 0 && in_array(strtolower($obj->extension), array('jpg', 'jpeg', 'png', 'gif', 'bmp')))
if (strpos($obj->mime_type, 'image/') === 0 && JHelperMedia::isImage($obj->name))
{
// Get the image properties
$props = JImage::getImageFileProperties($path);
Expand Down
4 changes: 2 additions & 2 deletions libraries/cms/helper/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class JHelperMedia
*
* @since 3.2
*/
public function isImage($fileName)
public static function isImage($fileName)
{
static $imageTypes = 'xcf|odg|gif|jpg|png|bmp';
static $imageTypes = 'xcf|odg|gif|jpg|jpeg|png|bmp';

return preg_match("/\.(?:$imageTypes)$/i", $fileName);
}
Expand Down

0 comments on commit 5f974c2

Please sign in to comment.