class ThumbView extends PaginationView {
function ThumbView() {}
/**
* Determine if the original image is actually an image and thus a thumbnail can be generated at all
*
* @access public
* @param mixed $image_name (optional)
* @param mixed $album (optional)
* @param mixed $section (optional)
* @return boolean
* @see mime_content_type
* @see actual_path
*/
function isImage($image_name = '', $album = '', $section = '') { // BOOLEAN METHOD
/*--------------------------------------------------------------------------------------------------------------------------------------------------------
ResizeView will inherit ThumbView::isImage() method now and thus will have its own instance of $this->id in existence
which is the image name and not an actual id (other instances of $this->id in class objects inheriting this method will
be numeric by database design). Set the obtainably inherited $this->{$section . '_name'} to $this->id.
---------------------------------------------------------------------------------------------------------------------------------------------------------*/
if (!$section) global $section;
global ${$section . 'LocationPath'};
if (!$this->{$section . '_name'} || $image_name) ThumbView::setThumbViewProperties($image_name, $album);
if ($this->{$section . '_name'}) {
if (strlen($this->album) > 0) $album = $this->album;
$locationPath = ($album) ? "${$section . 'LocationPath'}/$album" : ${$section . 'LocationPath'};
$imgStatArray = @getimagesize(actual_path("$locationPath/" . $this->{$section . '_name'}));
if (!is_array($imgStatArray) || @sizeof($imgStatArray) == 0) return false;
print_r("111<P>");
if (preg_match('/^image\//i', @mime_content_type(actual_path("$locationPath/" . $this->{$section . '_name'})))) return true;
print_r("222<P>");
}
print_r("333<P>");
return false; // WILL EVEN RETURN FALSE IF NO IMAGE NAME IS PROVIDED SINCE IMPOSSIBLE TO DETERMINE IF ?? IS AN IMAGE OR NOT
}
}
This class method, isImage(), for some bizarre reason, has the uncanny ability to return both TRUE AND FALSE literally at the exact same time, or so it seems!
This will be your output:
Based on this logic flow, that means that it should have returned true and that's it, but for some bizarre reason it is literally capable of returning true, then suddenly returning false, even though the method is called "statically":
if (!ThumbView::isImage($fileName, $_REQUEST['album'])) {
print_r("This is not an image<P>"); // ALWAYS PRINTS THIS EVEN IF IT *IS* AN IMAGE!!
}
Has anyone ever seen this within a statically called class method ever in PHP?
Phil