i try to convert an image png in jpg in a custom module with Magento. The upload works but when i try to convert the pic there is a prblm. There isn't method to convert in the Varien_file_uploader but in the Varien_image there is. I try that :
$uploader = new Varien_File_Uploader('image');
$uploader->setAllowedExtensions(array('jpg','png','gif','jpeg'));
$uploader->setAllowRenameFiles(false);
$uploader->setFilesDispersion(false);
$uploader->save($path, $_FILES['image']['name']);
$image = new Varien_Image($path . DS . $_FILES['image']['name']);
$image->convert('jpeg');
$image->save($path, 'mypic.jpeg');
Any ideas ? Thx
Aucun commentaire:
Enregistrer un commentaire