예제 #1
0
 public function ajaxUpload($params)
 {
     $pluginKey = $params['pluginKey'];
     $result = array();
     if (OW::getRequest()->isPost()) {
         if (!empty($_POST['command']) && $_POST['command'] == 'image-upload') {
             $imageId = UploadImageForm::addFile($pluginKey);
             if (is_numeric($imageId)) {
                 $img = BOL_MediaPanelService::getInstance()->findImage($imageId);
                 $url = OW::getStorage()->getFileUrl(OW::getPluginManager()->getPlugin('base')->getUserFilesDir() . $img->id . '-' . $img->getData()->name);
                 $result = array('file_url' => OW::getStorage()->getFileUrl(OW::getPluginManager()->getPlugin('base')->getUserFilesDir() . $img->id . '-' . $img->getData()->name));
             } else {
                 $result = array('error_message' => $imageId);
             }
         }
     }
     die(json_encode($result));
 }