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


PHP graphics::rotate方法代码示例

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


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

示例1: rotate

 public function rotate($id, $dir)
 {
     access::verify_csrf();
     $item = ORM::factory("item", $id);
     if (!$item->loaded) {
         return "";
     }
     $degrees = 0;
     switch ($dir) {
         case "ccw":
             $degrees = -90;
             break;
         case "cw":
             $degrees = 90;
             break;
     }
     if ($degrees) {
         graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
         list($item->width, $item->height) = getimagesize($item->file_path());
         $item->resize_dirty = 1;
         $item->thumb_dirty = 1;
         $item->save();
         graphics::generate($item);
         $parent = $item->parent();
         if ($parent->album_cover_item_id == $item->id) {
             copy($item->thumb_path(), $parent->thumb_path());
             $parent->thumb_width = $item->thumb_width;
             $parent->thumb_height = $item->thumb_height;
             $parent->save();
         }
     }
     print json_encode(array("src" => $item->thumb_url() . "?rnd=" . rand(), "width" => $item->thumb_width, "height" => $item->thumb_height));
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:33,代码来源:quick.php

示例2: _do_rotation

 private static function _do_rotation($item, $degrees)
 {
     // This code is copied from Quick_Controller::rotate
     graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
     list($item->width, $item->height) = getimagesize($item->file_path());
     $item->resize_dirty = 1;
     $item->thumb_dirty = 1;
     $item->save();
     graphics::generate($item);
     $parent = $item->parent();
     if ($parent->album_cover_item_id == $item->id) {
         copy($item->thumb_path(), $parent->thumb_path());
         $parent->thumb_width = $item->thumb_width;
         $parent->thumb_height = $item->thumb_height;
         $parent->save();
     }
     list($height, $width) = $item->scale_dimensions(90);
     $margin_top = (90 - $height) / 20;
     return array("src" => $item->thumb_url() . "?rnd=" . rand(), "id" => $item->id, "marginTop" => "{$margin_top}em", "width" => $width, "height" => $height);
 }
开发者ID:xafr,项目名称:gallery3,代码行数:20,代码来源:organize_task.php

示例3: rotate

 public function rotate($id, $dir)
 {
     access::verify_csrf();
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     $degrees = 0;
     switch ($dir) {
         case "ccw":
             $degrees = -90;
             break;
         case "cw":
             $degrees = 90;
             break;
     }
     if ($degrees) {
         graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
         list($item->width, $item->height) = getimagesize($item->file_path());
         $item->resize_dirty = 1;
         $item->thumb_dirty = 1;
         $item->save();
         graphics::generate($item);
         $parent = $item->parent();
         if ($parent->album_cover_item_id == $item->id) {
             copy($item->thumb_path(), $parent->thumb_path());
             $parent->thumb_width = $item->thumb_width;
             $parent->thumb_height = $item->thumb_height;
             $parent->save();
         }
     }
     if (Input::instance()->get("page_type") == "album") {
         print json_encode(array("src" => $item->thumb_url() . "?rnd=" . rand(), "width" => $item->thumb_width, "height" => $item->thumb_height));
     } else {
         print json_encode(array("src" => $item->resize_url() . "?rnd=" . rand(), "width" => $item->resize_width, "height" => $item->resize_height));
     }
 }
开发者ID:scarygary,项目名称:gallery3,代码行数:36,代码来源:quick.php

示例4: rotate

 public function rotate($id, $dir)
 {
     access::verify_csrf();
     $item = model_cache::get("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     $degrees = 0;
     switch ($dir) {
         case "ccw":
             $degrees = -90;
             break;
         case "cw":
             $degrees = 90;
             break;
     }
     if ($degrees) {
         graphics::rotate($item->file_path(), $item->file_path(), array("degrees" => $degrees));
         list($item->width, $item->height) = getimagesize($item->file_path());
         $item->resize_dirty = 1;
         $item->thumb_dirty = 1;
         $item->save();
         graphics::generate($item);
         $parent = $item->parent();
         if ($parent->album_cover_item_id == $item->id) {
             copy($item->thumb_path(), $parent->thumb_path());
             $parent->thumb_width = $item->thumb_width;
             $parent->thumb_height = $item->thumb_height;
             $parent->save();
         }
     }
     print json_encode(self::child_json_encode($item));
 }
开发者ID:ChrisRut,项目名称:gallery3-contrib,代码行数:32,代码来源:json_album.php


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