Zend Framework - Image Validation problem

Hi,

Im very new to Zend Framework. Im just wondering how to verify that a given file is a valid image or not. I have did some validation by renaming a file from sample.php to something like sample.gif. It passes the image validation by using the below code. I just want to prevent such file not to upload.

Any help is highly appreciated.

<CODE START>

$mainphoto=$this->createElement(‘File’,‘main_photo’);
$mainphoto->addValidator(‘SIZE’,TRUE, array(‘max’ => 10240000, ‘messages’ => array( Zend_Validate_File_Size::TOO_BIG => ‘The maximum permitted image file size is <b>%max%</b> - selected image file size is <b>%size%</b>.’)));
$mainphoto->setRequired(true);
$mainphoto->setLabel(‘Photo (Allowed Formats - jpg,jpeg,png,gif)’);
$mainphoto->addValidator(‘Extension’,FALSE,‘jpg,jpeg,png,gif’);
$mainphoto->addValidator(‘MimeType’, true, array(‘image/gif’, ‘image/JPEG’, ‘image/png’, ‘image/jpg’));

<CODE END>

Thanks in Advance,

Regards,
Vanash