I create a custom module in Magento 1.9 to upload some images. But I want to have this big images as a thumbnails too, how I can made a resize of the big images?
if(isset($_FILES['image']['name']) && $_FILES['image']['name'] != null) {
$result['file'] = '';
try {
$uploader = new Varien_File_Uploader('image');
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(false);
$path = Mage::getBaseDir('media') . DS.'images/'.DS ;
$result = $uploader->save($path, $_FILES['image']['name'] );
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage() . ' '. $path);
Mage::getSingleton('adminhtml/session')->setFormData($data);
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
return;
}
$data['image'] = 'images/'.$result['file'];
}
How I can duplicate and resize uploaded images to create thumbnails automatically.
Thank you