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

Commit

Permalink
Adding "jpeg" extension support to isImage() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxist committed Sep 1, 2010
1 parent eecffb1 commit 30d1fae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Function.php
Expand Up @@ -597,7 +597,7 @@ static public function isImage($address)
// Try to obtain the file extension
if(($id = strrpos($result['path'], '.')) !== false)
{
if(in_array(substr($result['path'], $id+1, 3), array('jpg', 'png', 'gif', 'svg', 'bmp')))
if(in_array(substr($result['path'], $id+1, 3), array('jpg', 'png', 'gif', 'svg', 'bmp')) || in_array(substr($result['path'], $id+1, 4), array('jpeg')))
{
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/function/isimage_1.txt
Expand Up @@ -8,6 +8,7 @@ Check the isImage() function.
<opt:if test="isImage('foo.gif')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
<opt:if test="isImage('foo.svg')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
<opt:if test="isImage('foo.bmp')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
<opt:if test="isImage('foo.jpeg')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
<opt:if test="isImage('http://www.example.com/image.png')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
<opt:if test="isImage('bogus')">IMAGE<opt:else>NOT IMAGE</opt:else></opt:if>
</opt:root>
Expand All @@ -22,4 +23,5 @@ IMAGE
IMAGE
IMAGE
IMAGE
IMAGE
NOT IMAGE

0 comments on commit 30d1fae

Please sign in to comment.