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


PHP BigTree::createCrop方法代码示例

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


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

示例1: processCrops

 static function processCrops($crop_key)
 {
     $storage = new BigTreeStorage();
     // Get and remove the crop data
     $crops = BigTreeCMS::cacheGet("org.bigtreecms.crops", $crop_key);
     BigTreeCMS::cacheDelete("org.bigtreecms.crops", $crop_key);
     foreach ($crops as $key => $crop) {
         $image_src = $crop["image"];
         $target_width = $crop["width"];
         $target_height = $crop["height"];
         $x = $_POST["x"][$key];
         $y = $_POST["y"][$key];
         $width = $_POST["width"][$key];
         $height = $_POST["height"][$key];
         $thumbs = $crop["thumbs"];
         $center_crops = $crop["center_crops"];
         $pinfo = pathinfo($image_src);
         // Create the crop and put it in a temporary location
         $temp_crop = SITE_ROOT . "files/" . uniqid("temp-") . "." . $pinfo["extension"];
         BigTree::createCrop($image_src, $temp_crop, $x, $y, $target_width, $target_height, $width, $height, $crop["retina"], $crop["grayscale"]);
         // Make thumbnails for the crop
         if (is_array($thumbs)) {
             foreach ($thumbs as $thumb) {
                 if (is_array($thumb) && ($thumb["height"] || $thumb["width"])) {
                     // We're going to figure out what size the thumbs will be so we can re-crop the original image so we don't lose image quality.
                     list($type, $w, $h, $result_width, $result_height) = BigTree::getThumbnailSizes($temp_crop, $thumb["width"], $thumb["height"]);
                     $temp_thumb = SITE_ROOT . "files/" . uniqid("temp-") . "." . $pinfo["extension"];
                     BigTree::createCrop($image_src, $temp_thumb, $x, $y, $result_width, $result_height, $width, $height, $crop["retina"], $thumb["grayscale"]);
                     $storage->replace($temp_thumb, $thumb["prefix"] . $crop["name"], $crop["directory"]);
                 }
             }
         }
         // Make center crops of the crop
         if (is_array($center_crops)) {
             foreach ($center_crops as $center_crop) {
                 if (is_array($center_crop) && $center_crop["height"] && $center_crop["width"]) {
                     $temp_center_crop = SITE_ROOT . "files/" . uniqid("temp-") . "." . $pinfo["extension"];
                     BigTree::centerCrop($temp_crop, $temp_center_crop, $center_crop["width"], $center_crop["height"], $crop["retina"], $center_crop["grayscale"]);
                     $storage->replace($temp_center_crop, $center_crop["prefix"] . $crop["name"], $crop["directory"]);
                 }
             }
         }
         // Move crop into its resting place
         $storage->replace($temp_crop, $crop["prefix"] . $crop["name"], $crop["directory"]);
     }
     // Remove all the temporary images
     foreach ($crops as $crop) {
         @unlink($crop["image"]);
     }
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:50,代码来源:admin.php

示例2: processCrops

 function processCrops($crops)
 {
     $storage = new BigTreeStorage();
     foreach ($crops as $key => $crop) {
         $image_src = $crop["image"];
         $target_width = $crop["width"];
         $target_height = $crop["height"];
         $prefix = $crop["prefix"];
         $x = $_POST["x"][$key];
         $y = $_POST["y"][$key];
         $width = $_POST["width"][$key];
         $height = $_POST["height"][$key];
         $thumbs = $crop["thumbs"];
         $pinfo = pathinfo($image_src);
         $temp_crop = SITE_ROOT . "files/" . uniqid("temp-") . "." . $pinfo["extension"];
         BigTree::createCrop($image_src, $temp_crop, $x, $y, $target_width, $target_height, $width, $height, $crop["retina"], $crop["grayscale"]);
         if (is_array($thumbs)) {
             foreach ($thumbs as $thumb) {
                 if (is_array($thumb) && ($thumb["height"] || $thumb["width"])) {
                     // We're going to figure out what size the thumbs will be so we can re-crop the original image so we don't lose image quality.
                     list($type, $w, $h, $result_width, $result_height) = BigTree::getThumbnailSizes($temp_crop, $thumb["width"], $thumb["height"]);
                     $temp_thumb = SITE_ROOT . "files/" . uniqid("temp-") . "." . $pinfo["extension"];
                     BigTree::createCrop($image_src, $temp_thumb, $x, $y, $result_width, $result_height, $width, $height, $crop["retina"], $thumb["grayscale"]);
                     $storage->replace($temp_thumb, $thumb["prefix"] . $crop["name"], $crop["directory"]);
                 }
             }
         }
         $storage->replace($temp_crop, $crop["prefix"] . $crop["name"], $crop["directory"]);
     }
     // Remove all the temporary images
     foreach ($crops as $crop) {
         @unlink($crop["image"]);
     }
 }
开发者ID:matthisamoto,项目名称:Graphfan,代码行数:34,代码来源:admin.php


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