当前位置: 首页>>代码示例>>PHP>>正文


PHP PerchUtil::set_file_permissions方法代码示例

本文整理汇总了PHP中PerchUtil::set_file_permissions方法的典型用法代码示例。如果您正苦于以下问题:PHP PerchUtil::set_file_permissions方法的具体用法?PHP PerchUtil::set_file_permissions怎么用?PHP PerchUtil::set_file_permissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PerchUtil的用法示例。


在下文中一共展示了PerchUtil::set_file_permissions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: move_uploaded_file

 public static function move_uploaded_file($filename, $destination)
 {
     $r = move_uploaded_file($filename, $destination);
     PerchUtil::set_file_permissions($destination);
     return $r;
 }
开发者ID:jaredmedley,项目名称:Perch-Core-Files,代码行数:6,代码来源:PerchUtil.class.php

示例2: resize_image


//.........这里部分代码省略.........
             if ($image_w / $target_w > $image_h / $target_h) {
                 $new_w = $target_w;
                 $new_h = $target_w / $image_ratio;
             } else {
                 $new_h = $target_h;
                 $new_w = $target_h * $image_ratio;
             }
         } else {
             if ($image_w > $image_h) {
                 $new_w = $target_w;
                 $new_h = $target_w / $image_ratio;
             }
             if ($image_h > $image_w) {
                 $new_h = $target_h;
                 $new_w = $target_h * $image_ratio;
             }
         }
     }
     // Default
     if (!isset($new_w)) {
         $new_w = $image_w;
         $new_h = $image_h;
     }
     // Prepare returned array
     $out = array();
     $out['w'] = (int) $new_w;
     $out['h'] = (int) $new_h;
     $out['file_path'] = $save_as;
     $parts = explode(DIRECTORY_SEPARATOR, $save_as);
     $out['file_name'] = array_pop($parts);
     $out['web_path'] = str_replace(PERCH_RESFILEPATH . DIRECTORY_SEPARATOR, PERCH_RESPATH . '/', $save_as);
     $out['density'] = $this->density;
     // If SVG, we can return at this point.
     if ($svg) {
         $out['mime'] = $svg;
         return $out;
     }
     if ($crop) {
         if ($crop_w) {
             $out['w'] = (int) $crop_w;
         }
         if ($crop_h) {
             $out['h'] = (int) $crop_h;
         }
     }
     // Check we're not upsizing
     if ($crop) {
         if ($crop_w > $image_w || $crop_h > $image_h) {
             $bail = true;
         }
     } else {
         if ($new_w > $image_w || $new_h > $image_h) {
             $bail = true;
         }
     }
     // Check we're not resizing to the same exact size, as this just kills quality
     if ($crop) {
         if ($crop_w == $image_w && $crop_h == $image_h) {
             $bail = true;
         }
     } else {
         if ($new_w == $image_w && $new_h == $image_h) {
             $bail = true;
         }
     }
     // Bail?
     if ($bail) {
         copy($image_path, $save_as);
         PerchUtil::set_file_permissions($save_as);
         // reset sizes
         $out['w'] = (int) $image_w;
         $out['h'] = (int) $image_h;
         $Perch->event('assets.create_image', new PerchAssetFile($out));
         return $out;
     }
     // Density
     $new_w = floor($new_w * $this->density);
     $new_h = floor($new_h * $this->density);
     $crop_w = floor($crop_w * $this->density);
     $crop_h = floor($crop_h * $this->density);
     $crop_x = floor($crop_x * $this->density);
     $crop_y = floor($crop_y * $this->density);
     //PerchUtil::debug('Density: '.$this->density);
     $r = false;
     if ($this->mode == 'gd') {
         $r = $this->resize_with_gd($image_path, $save_as, $new_w, $new_h, $crop_w, $crop_h, $crop_x, $crop_y);
     }
     if ($this->mode == 'imagick') {
         $r = $this->resize_with_imagick($image_path, $save_as, $new_w, $new_h, $crop_w, $crop_h, $crop_x, $crop_y);
     }
     if ($r) {
         $out['mime'] = $r;
     }
     PerchUtil::set_file_permissions($save_as);
     $Perch->event('assets.create_image', new PerchAssetFile($out));
     if ($r) {
         return $out;
     }
     return false;
 }
开发者ID:Bloom-web,项目名称:bloom-web,代码行数:101,代码来源:PerchImage.class.php

示例3: die

            }
        } else {
            die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}');
        }
        fclose($in);
        fclose($out);
    } else {
        die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');
    }
}
// If it's the last chunk
if ($chunks == 0 || $chunk == $chunks - 1) {
    $newFileName = str_replace('_uploading_', '', $fileName);
    rename($targetDir . DIRECTORY_SEPARATOR . $fileName, $targetDir . DIRECTORY_SEPARATOR . $newFileName);
    $albumID = (int) $_REQUEST["albumID"];
    $API = new PerchAPI(1.0, 'perch_gallery');
    $Images = new PerchGallery_Images($API);
    $Template = $API->get('Template');
    $Template->set('gallery/image.html', 'gallery');
    $data = array();
    $data['imageAlt'] = PerchUtil::strip_file_extension($newFileName);
    $data['albumID'] = $albumID;
    $Image = $Images->create($data);
    if (is_object($Image)) {
        $Image->process_versions($newFileName, $Template);
    }
    PerchUtil::set_file_permissions($targetDir . DIRECTORY_SEPARATOR . $newFileName);
    //file_put_contents(__DIR__.'/log.txt', strip_tags(PerchUtil::output_debug(true)));
}
// Return JSON-RPC response
die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}');
开发者ID:pete-naish,项目名称:4hair,代码行数:31,代码来源:upload.php


注:本文中的PerchUtil::set_file_permissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。