/**
  * Upload a new asset. No redirection and 	no response body, no flash message, for use by plupload (or similar).
  *
  * @param \_OurBrand_\Quiz\Domain\Model\ImageResource $image
  * @return string
  */
 public function uploadAction($image)
 {
     $dontcrop = intval($this->request->hasArgument('dontcrop') ? $this->request->getArgument('dontcrop') : 0);
     $maxwidth = intval($this->request->getArgument('maxwidth') > 0 ? $this->request->getArgument('maxwidth') : 800);
     $maxheight = intval($this->request->hasArgument('maxheight') ? $this->request->getArgument('maxheight') : 800);
     $minwidth = intval($this->request->hasArgument('minwidth') ? $this->request->getArgument('minwidth') : 0);
     $minheight = intval($this->request->hasArgument('minheight') ? $this->request->getArgument('minheight') : 0);
     $thumbWidth = intval($this->request->getArgument('thumbWidth') > 0 ? $this->request->getArgument('thumbWidth') : '');
     $thumbHeight = intval($this->request->getArgument('thumbHeight') > 0 ? $this->request->getArgument('thumbHeight') : '');
     $imageContainer = $this->request->hasArgument('imgcontainer') ? $this->request->getArgument('imgcontainer') : array();
     $renderPartial = $this->request->hasArgument('renderPartial') ? $this->request->getArgument('renderPartial') : '';
     if ($minwidth > 0 || $minheight > 0) {
         if ($image->getWidth() < $minwidth) {
             $errorMsg = $this->translateById('imageresource.upload.error.dimensions', array('uploaded' => $image->getWidth() . 'x' . $image->getHeight(), 'required' => $minwidth . 'x' . $minheight));
             $this->addFlashMessage($errorMsg);
             $this->redirect('new');
         } elseif ($image->getHeight() < $minheight) {
             $errorMsg = $this->translateById('imageresource.upload.error.dimensions', array('uploaded' => $image->getWidth() . 'x' . $image->getHeight(), 'required' => $minwidth . 'x' . $minheight));
             $this->addFlashMessage($errorMsg);
             $this->redirect('new');
         }
     }
     if ($image->getWidth() > $maxwidth) {
         $image->resizeImage($maxwidth);
     } elseif ($image->getHeight() > $maxheight) {
         $image->resizeImage(null, $maxheight);
     }
     if ($this->persistenceManager->isNewObject($image)) {
         $this->imageResourceRepository->add($image);
     } else {
         $this->imageResourceRepository->update($image);
     }
     if ($dontcrop == 1) {
         $this->forward('edit', NULL, NULL, array('image' => $image, 'mode' => 'crop', 'thumbWidth' => $thumbWidth, 'thumbHeight' => $thumbHeight, 'imgcon' => $imageContainer, 'renderPartial' => $renderPartial, 'dontcrop' => $dontcrop));
     } else {
         $this->forward('crop', NULL, NULL, array('image' => $image, 'thumbWidth' => $thumbWidth, 'thumbHeight' => $thumbHeight, 'imgcon' => $imageContainer, 'renderPartial' => $renderPartial, 'dontcrop' => $dontcrop));
     }
 }