Esempio n. 1
0
 /**
  * Handles uploading of a new watermark image.
  *
  */
 function uploadWatermark()
 {
     //watermark images can have different suffixes, but we only want one watermark file at a time.
     //instead of finding them all we just delete and recreate the directory.
     $wmDir = $this->_oc->getImgDir() . 'photoQWatermark/';
     PhotoQHelper::recursiveRemoveDir($wmDir);
     PhotoQHelper::createDir($wmDir);
     //put uploaded file into watermark directory
     if (!($file = $this->_handleUpload($wmDir))) {
         //$this->_errStack->push(PHOTOQ_FILE_UPLOAD_FAILED,'error', array('errMsg' => $file['error']));
         delete_option('wimpq_watermark');
     } else {
         $pathParts = PhotoQHelper::pathInfo($file);
         $newPath = preg_replace("#" . $pathParts['filename'] . "#", 'watermark', $file);
         PhotoQHelper::moveFile($file, $newPath);
         if (get_option('wimpq_watermark')) {
             update_option('wimpq_watermark', $newPath);
         } else {
             add_option('wimpq_watermark', $newPath);
         }
         //this is now done via batch processing
         //$this->rebuildPublished($this->_oc->getImageSizeNamesWithWatermark(), false, false, false);
         $this->_errStack->push(PHOTOQ_INFO_MSG, 'info', array(), __('New Watermark successfully uploaded. Updating image sizes including watermark...'));
     }
 }