Skip to content

Instantly share code, notes, and snippets.

@marchampson
Created March 6, 2013 14:46
Show Gist options
  • Save marchampson/5099764 to your computer and use it in GitHub Desktop.
Save marchampson/5099764 to your computer and use it in GitHub Desktop.
E3 Image utility example usage
// 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