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


PHP nggAdmin::rotate_image方法代码示例

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


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

示例1: ngg_rotateImage

function ngg_rotateImage()
{
    // check for correct capability
    if (!is_user_logged_in()) {
        die('-1');
    }
    // check for correct NextGEN capability
    if (!current_user_can('NextGEN Manage gallery')) {
        die('-1');
    }
    require_once dirname(dirname(__FILE__)) . '/ngg-config.php';
    // include the ngg function
    include_once dirname(__FILE__) . '/functions.php';
    $ngg_options = get_option('ngg_options');
    $id = (int) $_POST['id'];
    $result = '-1';
    switch ($_POST['ra']) {
        case 'cw':
            $result = nggAdmin::rotate_image($id, 'CW');
            break;
        case 'ccw':
            $result = nggAdmin::rotate_image($id, 'CCW');
            break;
        case 'fv':
            $result = nggAdmin::rotate_image($id, 0, 'V');
            break;
        case 'fh':
            $result = nggAdmin::rotate_image($id, 0, 'H');
            break;
    }
    // recreate the thumbnail
    nggAdmin::create_thumbnail($id);
    if ($result == 1) {
        die('1');
    }
    header('HTTP/1.1 500 Internal Server Error');
    die($result);
}
开发者ID:jhersonn20,项目名称:myportal,代码行数:38,代码来源:ajax.php

示例2: add_Images

 /**
  * Add images to database
  * 
  * @class nggAdmin
  * @param int $galleryID
  * @param array $imageslist
  * @return array $image_ids Id's which are sucessful added
  */
 function add_Images($galleryID, $imageslist)
 {
     global $wpdb, $ngg;
     $image_ids = array();
     if (is_array($imageslist)) {
         foreach ($imageslist as $picture) {
             // strip off the extension of the filename
             $path_parts = pathinfo($picture);
             $alttext = !isset($path_parts['filename']) ? substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')) : $path_parts['filename'];
             // save it to the database
             $pic_id = nggdb::add_image($galleryID, $picture, '', $alttext);
             if (!empty($pic_id)) {
                 $image_ids[] = $pic_id;
             }
             // add the metadata
             nggAdmin::import_MetaData($pic_id);
             // auto rotate
             nggAdmin::rotate_image($pic_id);
             // Autoresize image if required
             if ($ngg->options['imgAutoResize']) {
                 $imagetmp = nggdb::find_image($pic_id);
                 $sizetmp = @getimagesize($imagetmp->imagePath);
                 $widthtmp = $ngg->options['imgWidth'];
                 $heighttmp = $ngg->options['imgHeight'];
                 if ($sizetmp[0] > $widthtmp && $widthtmp || $sizetmp[1] > $heighttmp && $heighttmp) {
                     nggAdmin::resize_image($pic_id);
                 }
             }
             // action hook for post process after the image is added to the database
             $image = array('id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
             do_action('ngg_added_new_image', $image);
         }
     }
     // is_array
     // delete dirsize after adding new images
     delete_transient('dirsize_cache');
     do_action('ngg_after_new_images_added', $galleryID, $image_ids);
     return $image_ids;
 }
开发者ID:ahsaeldin,项目名称:projects,代码行数:47,代码来源:functions.php

示例3: add_Images

 /**
  * Add images to database
  * 
  * @class nggAdmin
  * @param int $galleryID
  * @param array $imageslist
  * @return array $image_ids Id's which are sucessful added
  */
 function add_Images($galleryID, $imageslist)
 {
     global $wpdb;
     $image_ids = array();
     if (is_array($imageslist)) {
         foreach ($imageslist as $picture) {
             // strip off the extension of the filename
             $path_parts = pathinfo($picture);
             $alttext = !isset($path_parts['filename']) ? substr($path_parts['basename'], 0, strpos($path_parts['basename'], '.')) : $path_parts['filename'];
             // save it to the database
             $result = $wpdb->query($wpdb->prepare("INSERT INTO {$wpdb->nggpictures} (galleryid, filename, alttext, exclude) VALUES (%s, %s, %s, 0)", $galleryID, $picture, $alttext));
             // and give me the new id
             $pic_id = (int) $wpdb->insert_id;
             if ($result) {
                 $image_ids[] = $pic_id;
             }
             // add the metadata
             nggAdmin::import_MetaData($pic_id);
             // auto rotate
             nggAdmin::rotate_image($pic_id);
             // action hook for post process after the image is added to the database
             $image = array('id' => $pic_id, 'filename' => $picture, 'galleryID' => $galleryID);
             do_action('ngg_added_new_image', $image);
         }
     }
     // is_array
     return $image_ids;
 }
开发者ID:alx,项目名称:SimplePress,代码行数:36,代码来源:functions.php


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