public function uploadImage() { if (!$this->checkAccess()) { return false; } wfProfileIn(__METHOD__); $upload = F::build('UploadVisualizationImageFromFile'); $status = $this->helper->uploadImage($upload); $result = array(); if ($status['status'] === 'uploadattempted' && $status['isGood']) { $file = $upload->getLocalFile(); $result['uploadType'] = $this->request->getVal('uploadType'); $result['imageIndex'] = $this->request->getVal('imageIndex', null); if ($result['uploadType'] == 'additional') { $width = SpecialPromoteHelper::SMALL_IMAGE_WIDTH; $height = SpecialPromoteHelper::SMALL_IMAGE_HEIGHT; } else { $width = SpecialPromoteHelper::LARGE_IMAGE_WIDTH; $height = SpecialPromoteHelper::LARGE_IMAGE_HEIGHT; } $result['fileUrl'] = $this->helper->getImageUrl($file->getName(), $width, $height); $result['fileName'] = $file->getName(); if ($result['fileUrl'] == null || $result['fileName'] == null) { $result['errorMessages'] = array(wfMsg('promote-error-unknown-upload-error')); } } else { if ($status['status'] === 'error') { $result['errorMessages'] = $status['errors']; } } $this->result = $result; wfProfileOut(__METHOD__); }