Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public function validateUploadFile($filePath) {
  2. $maxDimension = Mage::getStoreConfig(self::XML_NODE_PRODUCT_MAX_DIMENSION);
  3. $imageInfo = getimagesize($filePath);
  4. if (!$imageInfo) {
  5. Mage::throwException($this->__('Disallowed file type.'));
  6. }
  7.  
  8. if ($imageInfo[0] > $maxDimension || $imageInfo[1] > $maxDimension) {
  9. Mage::throwException($this->__('Disalollowed file format.'));
  10. }
  11.  
  12. $_processor = new Varien_Image($filePath);
  13. return $_processor->getMimeType() !== null;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement