本文整理汇总了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));
}
示例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);
}
示例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));
}
}
示例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));
}