Created
March 6, 2013 14:46
-
-
Save marchampson/5099764 to your computer and use it in GitHub Desktop.
E3 Image utility example usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Upload file | |
$File = $this->params()->fromFiles('image'); | |
if($File['name'] != '') { | |
$thumbsDir = array( | |
array('dir' => 'small', | |
'resize' => '25'), | |
array('dir' => 'medium', | |
'resize' => '50'), | |
array('dir' => 'large', | |
'resize' => '75') | |
); | |
$ImageUtilities = $this->getServiceLocator()->get('image_utility'); | |
if($ImageUtilities->uploadImageFile('image', $author->imageDir, $File, $thumbsDir)) { | |
$data->image = $File['name']; | |
} | |
} else { | |
if($form->get('preview')) { | |
$storedImage = $form->get('preview')->getAttribute('src'); | |
$data->image = basename($storedImage); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment