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

Use the isImage function in the media helper #153

Merged
merged 2 commits into from
Apr 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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