示例#1
0
 protected function _saveDefaultImage($deleteIcon = false)
 {
     $image_filepath = 'files/attach/xeicon/';
     $site_info = Context::get('site_module_info');
     if ($site_info->site_srl) {
         $image_filepath .= $site_info->site_srl . '/';
     }
     if ($deleteIcon) {
         $info = Rhymix\Framework\Storage::readPHPData($image_filepath . 'default_image.php');
         if ($info['filename']) {
             Rhymix\Framework\Storage::delete(\RX_BASEDIR . $info['filename']);
         }
         Rhymix\Framework\Storage::delete($image_filepath . 'default_image.php');
         return;
     }
     $tmpicon_filepath = \RX_BASEDIR . $image_filepath . 'tmp/default_image.png';
     if (file_exists($tmpicon_filepath)) {
         list($width, $height, $type) = @getimagesize($tmpicon_filepath);
         switch ($type) {
             case 'image/gif':
                 $target_filename = $image_filepath . 'default_image.gif';
                 break;
             case 'image/jpeg':
                 $target_filename = $image_filepath . 'default_image.jpg';
                 break;
             case 'image/png':
             default:
                 $target_filename = $image_filepath . 'default_image.png';
         }
         Rhymix\Framework\Storage::move($tmpicon_filepath, \RX_BASEDIR . $target_filename);
         Rhymix\Framework\Storage::writePHPData(\RX_BASEDIR . 'files/attach/xeicon/' . $virtual_site . 'default_image.php', array('filename' => $target_filename, 'width' => $width, 'height' => $height));
     }
 }
示例#2
0
 /**
  * Move a directory
  *
  * This function just wraps rename function.
  *
  * @param string $source_dir Path of source directory
  * @param string $target_dir Path of target directory
  * @return void
  */
 public static function moveDir($source_dir, $target_dir)
 {
     return Rhymix\Framework\Storage::move(self::getRealPath($source_dir), self::getRealPath($target_dir));
 }