• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP graphics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: save

 public function save()
 {
     access::verify_csrf();
     $form = theme::get_edit_form_admin();
     if ($form->validate()) {
         module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
         $thumb_size = $form->edit_theme->thumb_size->value;
         $thumb_dirty = false;
         if (module::get_var("gallery", "thumb_size") != $thumb_size) {
             graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
             graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "thumb_size", $thumb_size);
         }
         $resize_size = $form->edit_theme->resize_size->value;
         $resize_dirty = false;
         if (module::get_var("gallery", "resize_size") != $resize_size) {
             graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
             graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "resize_size", $resize_size);
         }
         module::set_var("gallery", "header_text", $form->edit_theme->header_text->value);
         module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value);
         module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
         message::success(t("Updated theme details"));
         url::redirect("admin/theme_options");
     } else {
         $view = new Admin_View("admin.html");
         $view->content = $form;
         print $view;
     }
 }
开发者ID:brocki,项目名称:gallery3,代码行数:31,代码来源:admin_theme_options.php


示例2: uninstall

 static function uninstall()
 {
     graphics::remove_rules("watermark");
     module::delete("watermark");
     Database::instance()->query("DROP TABLE `watermarks`");
     dir::unlink(VARPATH . "modules/watermark");
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:watermark_installer.php


示例3: save

 public function save()
 {
     access::verify_csrf();
     $form = $this->_get_edit_form_admin();
     if ($form->validate()) {
         module::set_var("gallery", "page_size", $form->edit_theme->page_size->value);
         $thumb_size = $form->edit_theme->thumb_size->value;
         if (module::get_var("gallery", "thumb_size") != $thumb_size) {
             graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
             graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => $thumb_size, "height" => $thumb_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "thumb_size", $thumb_size);
         }
         $resize_size = $form->edit_theme->resize_size->value;
         if (module::get_var("gallery", "resize_size") != $resize_size) {
             graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
             graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
             module::set_var("gallery", "resize_size", $resize_size);
         }
         module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
         // Sanitize values that get placed directly in HTML output by theme.
         module::set_var("gallery", "header_text", html::purify($form->edit_theme->header_text->value));
         module::set_var("gallery", "footer_text", html::purify($form->edit_theme->footer_text->value));
         module::set_var("gallery", "favicon_url", html::purify($form->edit_theme->favicon_url->value));
         module::set_var("gallery", "apple_touch_icon_url", html::purify($form->edit_theme->apple_touch_icon_url->value));
         module::event("theme_edit_form_completed", $form);
         message::success(t("Updated theme details"));
         url::redirect("admin/theme_options");
     } else {
         $view = new Admin_View("admin.html");
         $view->content = new View("admin_theme_options.html");
         $view->content->form = $form;
         print $view;
     }
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:34,代码来源:admin_theme_options.php


示例4: rebuild_dirty_images

 /**
  * Task that rebuilds all dirty images.
  * @param Task_Model the task
  */
 static function rebuild_dirty_images($task)
 {
     $errors = array();
     try {
         $result = graphics::find_dirty_images_query()->select("id")->execute();
         $total_count = $task->get("total_count", $result->count());
         $mode = $task->get("mode", "init");
         if ($mode == "init") {
             $task->set("total_count", $total_count);
             $task->set("mode", "process");
             batch::start();
         }
         $completed = $task->get("completed", 0);
         $ignored = $task->get("ignored", array());
         $i = 0;
         foreach ($result as $row) {
             if (array_key_exists($row->id, $ignored)) {
                 continue;
             }
             $item = ORM::factory("item", $row->id);
             if ($item->loaded()) {
                 try {
                     graphics::generate($item);
                     $completed++;
                     $errors[] = t("Successfully rebuilt images for '%title'", array("title" => html::purify($item->title)));
                 } catch (Exception $e) {
                     $errors[] = t("Unable to rebuild images for '%title'", array("title" => html::purify($item->title)));
                     $errors[] = (string) $e;
                     $ignored[$item->id] = 1;
                 }
             }
             if (++$i == 2) {
                 break;
             }
         }
         $task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, array("total_count" => $total_count));
         if ($completed < $total_count) {
             $task->percent_complete = (int) (100 * ($completed + count($ignored)) / $total_count);
         } else {
             $task->percent_complete = 100;
         }
         $task->set("completed", $completed);
         $task->set("ignored", $ignored);
         if ($task->percent_complete == 100) {
             $task->done = true;
             $task->state = "success";
             batch::stop();
             site_status::clear("graphics_dirty");
         }
     } catch (Exception $e) {
         Kohana_Log::add("error", (string) $e);
         $task->done = true;
         $task->state = "error";
         $task->status = $e->getMessage();
         $errors[] = (string) $e;
     }
     if ($errors) {
         $task->log($errors);
     }
 }
开发者ID:andyst,项目名称:gallery3,代码行数:64,代码来源:gallery_task.php


示例5: crop_to_aspect_ratio

 /**
  * Crop the input image so that it matches the aspect ratio specified in the
  * rectangle_thumbs.aspect_ratio module setting.  Focus on the center of the image and crop out
  * the biggest piece that we can.
  *
  * @param string     $input_file
  * @param string     $output_file
  * @param array      $options
  */
 static function crop_to_aspect_ratio($input_file, $output_file, $options)
 {
     graphics::init_toolkit();
     if (@filesize($input_file) == 0) {
         throw new Exception("@todo EMPTY_INPUT_FILE");
     }
     list($desired_width, $desired_height) = explode(":", module::get_var("rectangle_thumbs", "aspect_ratio"));
     $desired_ratio = $desired_width / $desired_height;
     // Crop the largest rectangular section we can out of the original image.  Start with a
     // rectangular section that's guaranteed to be too large, then shrink it horizontally to just
     // barely fit.  If it's still too tall vertically, shrink both dimensions proportionally until
     // the horizontal edge fits as well.
     $dims = getimagesize($input_file);
     if ($desired_ratio == 1) {
         $new_width = $new_height = min($dims[0], $dims[1]);
     } else {
         if ($desired_ratio < 1) {
             list($new_width, $new_height) = array($dims[0], $dims[0] / $desired_ratio);
         } else {
             list($new_width, $new_height) = array($dims[1] * $desired_ratio, $dims[1]);
         }
     }
     if ($new_width > $dims[0]) {
         // Too wide, scale it down
         list($new_width, $new_height) = array($dims[0], $dims[0] / $desired_ratio);
     }
     if ($new_height > $dims[1]) {
         // Too tall, scale it down some more
         $new_width = min($dims[0], $dims[1] * $desired_ratio);
         $new_height = $new_width / $desired_ratio;
     }
     $new_width = round($new_width);
     $new_height = round($new_height);
     Image::factory($input_file)->crop($new_width, $new_height)->quality(module::get_var("gallery", "image_quality"))->save($output_file);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:44,代码来源:rectangle_thumbs_graphics.php


示例6: rebuild_dirty_images

 /**
  * Task that rebuilds all dirty images.
  * @param Task_Model the task
  */
 static function rebuild_dirty_images($task)
 {
     $result = graphics::find_dirty_images_query();
     $remaining = $result->count();
     $completed = $task->get("completed", 0);
     $i = 0;
     foreach ($result as $row) {
         $item = ORM::factory("item", $row->id);
         if ($item->loaded) {
             graphics::generate($item);
         }
         $completed++;
         $remaining--;
         if (++$i == 2) {
             break;
         }
     }
     $task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, array("total_count" => $remaining + $completed));
     if ($completed + $remaining > 0) {
         $task->percent_complete = (int) (100 * $completed / ($completed + $remaining));
     } else {
         $task->percent_complete = 100;
     }
     $task->set("completed", $completed);
     if ($remaining == 0) {
         $task->done = true;
         $task->state = "success";
         site_status::clear("graphics_dirty");
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:34,代码来源:core_task.php


示例7: rotate

 /**
  * Rotate an image.  Valid options are degrees
  *
  * @param string     $input_file
  * @param string     $output_file
  * @param array      $options
  */
 static function rotate($input_file, $output_file, $options)
 {
     graphics::init_toolkit();
     module::event("graphics_rotate", $input_file, $output_file, $options);
     // BEGIN mod to original function
     $image_info = getimagesize($input_file);
     // [0]=w, [1]=h, [2]=type (1=GIF, 2=JPG, 3=PNG)
     if (module::get_var("image_optimizer", "rotate_jpg") || $image_info[2] == 2) {
         // rotate_jpg enabled, the file is a jpg.  get args
         $path = module::get_var("image_optimizer", "path_jpg");
         $exec_args = " -rotate ";
         $exec_args .= $options["degrees"] > 0 ? $options["degrees"] : $options["degrees"] + 360;
         $exec_args .= " -copy all -optimize -outfile ";
         // run it - from input_file to tmp_file
         $tmp_file = image_optimizer::make_temp_name($output_file);
         exec(escapeshellcmd($path) . $exec_args . escapeshellarg($tmp_file) . " " . escapeshellarg($input_file), $exec_output, $exec_status);
         if ($exec_status || !filesize($tmp_file)) {
             // either a blank/nonexistant file or an error - log an error and pass to normal function
             Kohana_Log::add("error", "image_optimizer rotation failed on " . $output_file);
             unlink($tmp_file);
         } else {
             // worked - move temp to output
             rename($tmp_file, $output_file);
             $status = true;
         }
     }
     if (!$status) {
         // we got here if we weren't supposed to use jpegtran or if jpegtran failed
         // END mod to original function
         Image::factory($input_file)->quality(module::get_var("gallery", "image_quality"))->rotate($options["degrees"])->save($output_file);
         // BEGIN mod to original function
     }
     // END mod to original function
     module::event("graphics_rotate_completed", $input_file, $output_file, $options);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:42,代码来源:MY_gallery_graphics.php


示例8: item_created

 static function item_created($item)
 {
     // Only works on photos
     if (!$item->is_photo()) {
         return;
     }
     // Locate jhead
     if (!is_file($path = exec('which jhead'))) {
         // @todo throw an exception ?
         Kohana::log('error', 'jhead is not installed');
     }
     $binary = str_replace('\\', '/', realpath(dirname($path)));
     $binary .= '/jhead';
     $binary .= PHP_SHLIB_SUFFIX === 'dll' ? '.exe' : '';
     if (!is_file($binary)) {
         // @todo throw an exception ?
         Kohana::log('error', 'Unable to locate jhead binary');
     }
     // Invoke jhead
     if ($error = exec(escapeshellcmd($binary) . ' -q -autorot ' . $item->file_path())) {
         // @todo throw an exception ?
         Kohana::log('error', 'Error during execution of jhead');
     }
     // Update item
     $image_info = getimagesize($item->file_path());
     $item->width = $image_info[0];
     $item->height = $image_info[1];
     $item->resize_dirty = 1;
     $item->thumb_dirty = 1;
     $item->save();
     graphics::generate($item);
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:32,代码来源:jhead_event.php


示例9: install

 static function install()
 {
     // Insert a rule into the thumbnail generation pipeline that converts the source image to the
     // right aspect ratio such that when we resize it down, it comes out to the right dimensions.
     graphics::add_rule("rectangle_thumbs", "thumb", "rectangle_thumbs_graphics::crop_to_aspect_ratio", array(), 50);
     module::set_var("rectangle_thumbs", "aspect_ratio", "3:1");
     module::set_version("rectangle_thumbs", 1);
 }
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:8,代码来源:rectangle_thumbs_installer.php


示例10: composite

 /**
  * Overlay an image on top of the input file.
  *
  * Valid options are: file, mime_type, position, transparency_percent, padding
  *
  * Valid positions: northwest, north, northeast,
  *                  west, center, east,
  *                  southwest, south, southeast
  *
  * padding is in pixels
  *
  * @param string     $input_file
  * @param string     $output_file
  * @param array      $options
  */
 static function composite($input_file, $output_file, $options)
 {
     try {
         graphics::init_toolkit();
         module::event("graphics_composite", $input_file, $output_file, $options);
         list($width, $height) = getimagesize($input_file);
         list($w_width, $w_height) = getimagesize($options["file"]);
         $pad = isset($options["padding"]) ? $options["padding"] : 10;
         $top = $pad;
         $left = $pad;
         $y_center = max($height / 2 - $w_height / 2, $pad);
         $x_center = max($width / 2 - $w_width / 2, $pad);
         $bottom = max($height - $w_height - $pad, $pad);
         $right = max($width - $w_width - $pad, $pad);
         switch ($options["position"]) {
             case "northwest":
                 $x = $left;
                 $y = $top;
                 break;
             case "north":
                 $x = $x_center;
                 $y = $top;
                 break;
             case "northeast":
                 $x = $right;
                 $y = $top;
                 break;
             case "west":
                 $x = $left;
                 $y = $y_center;
                 break;
             case "center":
                 $x = $x_center;
                 $y = $y_center;
                 break;
             case "east":
                 $x = $right;
                 $y = $y_center;
                 break;
             case "southwest":
                 $x = $left;
                 $y = $bottom;
                 break;
             case "south":
                 $x = $x_center;
                 $y = $bottom;
                 break;
             case "southeast":
                 $x = $right;
                 $y = $bottom;
                 break;
         }
         Image::factory($input_file)->composite($options["file"], $x, $y, $options["transparency"])->quality(module::get_var("gallery", "image_quality"))->save($output_file);
         module::event("graphics_composite_completed", $input_file, $output_file, $options);
     } catch (ErrorException $e) {
         Kohana::log("error", $e->get_message());
     }
 }
开发者ID:brocki,项目名称:gallery3,代码行数:73,代码来源:gallery_graphics.php


示例11: user_login

 static function user_login($user)
 {
     // If this user is an admin, check to see if there are any post-install tasks that we need
     // to run and take care of those now.
     if ($user->admin && module::get_var("gallery", "choose_default_tookit", null)) {
         graphics::choose_default_toolkit();
         module::clear_var("gallery", "choose_default_tookit");
     }
 }
开发者ID:xafr,项目名称:gallery3,代码行数:9,代码来源:gallery_event.php


示例12: crop_to_square

 /**
  * Crop the input image so that it's square.  Focus on the center of the image.
  *
  * @param string     $input_file
  * @param string     $output_file
  * @param array      $options
  */
 static function crop_to_square($input_file, $output_file, $options)
 {
     graphics::init_toolkit();
     if (@filesize($input_file) == 0) {
         throw new Exception("@todo EMPTY_INPUT_FILE");
     }
     $size = module::get_var("gallery", "thumb_size");
     $dims = getimagesize($input_file);
     Image::factory($input_file)->crop(min($dims[0], $dims[1]), min($dims[0], $dims[1]))->quality(module::get_var("gallery", "image_quality"))->save($output_file);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:17,代码来源:square_thumbs_graphics.php


示例13: save

 public function save()
 {
     access::verify_csrf();
     $form = self::get_edit_form_admin();
     if ($form->validate()) {
         $edit_theme = $form->edit_theme;
         module::set_var("gallery", "page_size", $edit_theme->row_count->value * 3);
         $resize_size = $edit_theme->resize_size->value;
         $thumb_size = 200;
         $build_resize = $edit_theme->build_resize->value;
         $build_thumbs = $edit_theme->build_thumbs->value;
         if (module::get_var("gallery", "resize_size") != $resize_size) {
             module::set_var("gallery", "resize_size", $resize_size);
             $build_resize = true;
         }
         if (module::get_var("gallery", "thumb_size") != $thumb_size) {
             module::set_var("gallery", "thumb_size", $thumb_size);
         }
         if ($build_resize) {
             graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
             graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
         }
         if ($build_thumbs) {
             graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
             graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", array("width" => 200, "height" => 200, "master" => Image::AUTO), 100);
         }
         module::set_var("th_greydragon", "photonav_top", $edit_theme->photonav_top->value);
         module::set_var("th_greydragon", "photonav_bottom", $edit_theme->photonav_bottom->value);
         $sidebar_allowed = $edit_theme->sidebar_allowed->value;
         $sidebar_visible = $edit_theme->sidebar_visible->value;
         if ($sidebar_allowed == "none") {
             $sidebar_visible = "none";
         }
         if ($sidebar_allowed == "right") {
             $sidebar_visible = "right";
         }
         if ($sidebar_allowed == "left") {
             $sidebar_visible = "left";
         }
         module::set_var("th_greydragon", "sidebar_allowed", $sidebar_allowed);
         module::set_var("th_greydragon", "sidebar_visible", $sidebar_visible);
         module::set_var("gallery", "header_text", $edit_theme->header_text->value);
         module::set_var("gallery", "footer_text", $edit_theme->footer_text->value);
         module::set_var("gallery", "show_credits", $edit_theme->show_credits->value);
         module::set_var("th_greydragon", "copyright", $edit_theme->copyright->value);
         module::set_var("th_greydragon", "logo_path", $edit_theme->logo_path->value);
         module::event("theme_edit_form_completed", $form);
         message::success(t("Updated theme details"));
         url::redirect("admin/theme_options");
     } else {
         $view = new Admin_View("admin.html");
         $view->content = $form;
         print $view;
     }
 }
开发者ID:Okat,项目名称:gallery3-contrib,代码行数:55,代码来源:admin_theme_options.php


示例14: remove_album_cover

 static function remove_album_cover($album)
 {
     access::required("edit", $album);
     @unlink($album->thumb_path());
     model_cache::clear("item", $album->album_cover_item_id);
     $album->album_cover_item_id = null;
     $album->thumb_width = 0;
     $album->thumb_height = 0;
     $album->thumb_dirty = 1;
     $album->save();
     graphics::generate($album);
 }
开发者ID:xafr,项目名称:gallery3,代码行数:12,代码来源:item.php


示例15: rebuild_dirty_images

 /**
  * Task that rebuilds all dirty images.
  * @param Task_Model the task
  */
 static function rebuild_dirty_images($task)
 {
     $errors = array();
     try {
         $result = graphics::find_dirty_images_query();
         $completed = $task->get("completed", 0);
         $ignored = $task->get("ignored", array());
         $remaining = $result->count() - count($ignored);
         $i = 0;
         foreach ($result as $row) {
             if (array_key_exists($row->id, $ignored)) {
                 continue;
             }
             $item = ORM::factory("item", $row->id);
             if ($item->loaded) {
                 try {
                     graphics::generate($item);
                     $ignored[$item->id] = 1;
                     $errors[] = t("Successfully rebuilt images for '%title'", array("title" => html::purify($item->title)));
                 } catch (Exception $e) {
                     $errors[] = t("Unable to rebuild images for '%title'", array("title" => html::purify($item->title)));
                     $errors[] = $e->__toString();
                 }
             }
             $completed++;
             $remaining--;
             if (++$i == 2) {
                 break;
             }
         }
         $task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, array("total_count" => $remaining + $completed));
         if ($completed + $remaining > 0) {
             $task->percent_complete = (int) (100 * $completed / ($completed + $remaining));
         } else {
             $task->percent_complete = 100;
         }
         $task->set("completed", $completed);
         $task->set("ignored", $ignored);
         if ($remaining == 0) {
             $task->done = true;
             $task->state = "success";
             site_status::clear("graphics_dirty");
         }
     } catch (Exception $e) {
         $task->done = true;
         $task->state = "error";
         $task->status = $e->getMessage();
         $errors[] = $e->__toString();
     }
     if ($errors) {
         $task->log($errors);
     }
 }
开发者ID:Okat,项目名称:gallery3,代码行数:57,代码来源:gallery_task.php


示例16: buttons

 static function buttons($item, $page_type)
 {
     $elements = array("left" => array(), "center" => array(), "right" => array(), "additional" => array());
     switch ($item->type) {
         case "movie":
             $edit_title = t("Edit this movie");
             $move_title = t("Move this movie to another album");
             $cover_title = t("Choose this movie as the album cover");
             $delete_title = t("Delete this movie");
             break;
         case "album":
             $edit_title = t("Edit this album");
             $move_title = t("Move this album to another album");
             $cover_title = t("Choose this album as the album cover");
             $delete_title = t("Delete this album");
             break;
         default:
             $edit_title = t("Edit this photo");
             $move_title = t("Move this photo to another album");
             $cover_title = t("Choose this photo as the album cover");
             $delete_title = t("Delete this photo");
             break;
     }
     $csrf = access::csrf_token();
     $elements["left"][] = (object) array("title" => $edit_title, "class" => "gDialogLink gButtonLink", "icon" => "ui-icon-pencil", "href" => url::site("quick/form_edit/{$item->id}?page_type={$page_type}"));
     if ($item->is_photo() && graphics::can("rotate")) {
         $elements["left"][] = (object) array("title" => t("Rotate 90 degrees counter clockwise"), "class" => "gButtonLink", "icon" => "ui-icon-rotate-ccw", "href" => url::site("quick/rotate/{$item->id}/ccw?csrf={$csrf}&page_type={$page_type}"));
         $elements["left"][] = (object) array("title" => t("Rotate 90 degrees clockwise"), "class" => "gButtonLink", "icon" => "ui-icon-rotate-cw", "href" => url::site("quick/rotate/{$item->id}/cw?csrf={$csrf}&page_type={$page_type}"));
     }
     // Don't move photos from the photo page; we don't yet have a good way of redirecting after move
     if ($page_type == "album") {
         $elements["left"][] = (object) array("title" => $move_title, "class" => "gDialogLink gButtonLink", "icon" => "ui-icon-folder-open", "href" => url::site("move/browse/{$item->id}"));
     }
     $parent = $item->parent();
     if (access::can("edit", $parent)) {
         // We can't make this item the highlight if it's an album with no album cover, or if it's
         // already the album cover.
         if ($item->type == "album" && empty($item->album_cover_item_id) || $item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id || $parent->album_cover_item_id == $item->id) {
             $disabledState = " ui-state-disabled";
         } else {
             $disabledState = " ";
         }
         $elements["right"][] = (object) array("title" => $cover_title, "class" => "gButtonLink{$disabledState}", "icon" => "ui-icon-star", "href" => url::site("quick/make_album_cover/{$item->id}?csrf={$csrf}&page_type={$page_type}"));
         $elements["right"][] = (object) array("title" => $delete_title, "class" => "gDialogLink gButtonLink", "icon" => "ui-icon-trash", "id" => "gQuickDelete", "href" => url::site("quick/form_delete/{$item->id}?csrf={$csrf}&page_type={$page_type}"));
     }
     if ($item->is_album()) {
         $elements["additional"][] = (object) array("title" => t("Add a photo"), "class" => "add_item gDialogLink", "href" => url::site("simple_uploader/app/{$item->id}"));
         $elements["additional"][] = (object) array("title" => t("Add an album"), "class" => "add_album gDialogLink", "href" => url::site("form/add/albums/{$item->id}?type=album"));
         $elements["additional"][] = (object) array("title" => t("Edit permissions"), "class" => "permissions gDialogLink", "href" => url::site("permissions/browse/{$item->id}"));
     }
     return $elements;
 }
开发者ID:eo04837,项目名称:gallery3,代码行数:52,代码来源:gallery_quick.php


示例17: choose

 public function choose($toolkit_id)
 {
     access::verify_csrf();
     if ($toolkit_id != module::get_var("gallery", "graphics_toolkit")) {
         $tk = graphics::detect_toolkits();
         module::set_var("gallery", "graphics_toolkit", $toolkit_id);
         module::set_var("gallery", "graphics_toolkit_path", $tk->{$toolkit_id}->dir);
         site_status::clear("missing_graphics_toolkit");
         $msg = t("Changed graphics toolkit to: %toolkit", array("toolkit" => $tk->{$toolkit_id}->name));
         message::success($msg);
         log::success("graphics", $msg);
     }
     url::redirect("admin/graphics");
 }
开发者ID:jhilden,项目名称:gallery3,代码行数:14,代码来源:admin_graphics.php


示例18: choose

 public function choose($toolkit)
 {
     access::verify_csrf();
     if ($toolkit != module::get_var("gallery", "graphics_toolkit")) {
         module::set_var("gallery", "graphics_toolkit", $toolkit);
         $toolkit_info = graphics::detect_toolkits();
         if ($toolkit == "graphicsmagick" || $toolkit == "imagemagick") {
             module::set_var("gallery", "graphics_toolkit_path", $toolkit_info[$toolkit]);
         }
         site_status::clear("missing_graphics_toolkit");
         message::success(t("Updated Graphics Toolkit"));
         log::success("graphics", t("Changed graphics toolkit to: %toolkit", array("toolkit" => $toolkit)));
     }
     url::redirect("admin/graphics");
 }
开发者ID:xafr,项目名称:gallery3,代码行数:15,代码来源:admin_graphics.php


示例19: create

 /**
  * Create a new photo.
  * @param integer $parent_id id of parent album
  * @param string  $filename path to the photo file on disk
  * @param string  $name the filename to use for this photo in the album
  * @param integer $title the title of the new photo
  * @param string  $description (optional) the longer description of this photo
  * @return Item_Model
  */
 static function create($parent, $filename, $name, $title, $description = null, $owner_id = null)
 {
     if (!$parent->loaded || $parent->type != "album") {
         throw new Exception("@todo INVALID_PARENT");
     }
     if (!is_file($filename)) {
         throw new Exception("@todo MISSING_IMAGE_FILE");
     }
     if (!($image_info = getimagesize($filename))) {
         throw new Exception("@todo INVALID_IMAGE_FILE");
     }
     // Force an extension onto the name
     $pi = pathinfo($name);
     if (empty($pi["extension"])) {
         $pi["extension"] = image_type_to_extension($image_info[2], false);
         $name .= "." . $pi["extension"];
     }
     $photo = ORM::factory("item");
     $photo->type = "photo";
     $photo->title = $title;
     $photo->description = $description;
     $photo->name = $name;
     $photo->owner_id = $owner_id;
     $photo->width = $image_info[0];
     $photo->height = $image_info[1];
     $photo->mime_type = empty($image_info['mime']) ? "application/unknown" : $image_info['mime'];
     $photo->thumb_dirty = 1;
     $photo->resize_dirty = 1;
     // Randomize the name if there's a conflict
     while (ORM::Factory("item")->where("parent_id", $parent->id)->where("name", $photo->name)->find()->id) {
         // @todo Improve this.  Random numbers are not user friendly
         $photo->name = rand() . "." . $pi["extension"];
     }
     // This saves the photo
     $photo->add_to_parent($parent);
     copy($filename, $photo->file_path());
     module::event("item_created", $photo);
     // Build our thumbnail/resizes
     graphics::generate($photo);
     // If the parent has no cover item, make this it.
     $parent = $photo->parent();
     if ($parent->album_cover_item_id == null) {
         $parent->album_cover_item_id = $photo->id;
         $parent->save();
         graphics::generate($parent);
     }
     return $photo;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:57,代码来源:photo.php


示例20: save

 public function save()
 {
     access::verify_csrf();
     $form = $this->_get_admin_form();
     if ($form->validate()) {
         module::set_var("gallery", "movie_allow_uploads", $form->settings->allow_uploads->value);
         if ($form->settings->rebuild_thumbs->value) {
             graphics::mark_dirty(true, false, "movie");
         }
         // All done - redirect with message.
         message::success(t("Movies settings updated successfully"));
         url::redirect("admin/movies");
     }
     // Something went wrong - print view from existing form.
     $this->_print_view($form);
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:16,代码来源:admin_movies.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP grid_param类代码示例发布时间:2022-05-23
下一篇:
PHP graph类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap