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


PHP Picture::addLightbox方法代码示例

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


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

示例1: render


//.........这里部分代码省略.........
     $gallery_row = null;
     $files = scandir($this->path, 1);
     for ($i = 0; $i < sizeof($files); $i++) {
         $file = $files[$i];
         if ($file != "." && $file != "..") {
             $getExt = explode(".", $file);
             $countExt = count($getExt);
             $fExt = $countExt - 1;
             $myExt = $getExt[$fExt];
             if ((is_dir($this->path . $file) || $this->in_arrayi($myExt, $this->picture_ext)) && $file != $this->thumbnail_folder) {
                 if ($ind != $last_ind && $ind % $this->nb_col == 0) {
                     if ($gallery_row != null) {
                         $gallery_table->addRow($gallery_row);
                     }
                     $gallery_row = new RowTable();
                     $gallery_row->setWidth("25%");
                     $last_ind = $ind;
                 }
                 if (is_dir($this->path . $file)) {
                     if ($this->subfolder) {
                         $folder_pic = new Picture($this->folder_pic, 128, 128, 0, Picture::ALIGN_ABSMIDDLE, $file);
                         $url = $this->getPage()->getCurrentURL();
                         if (($pos = find($url, "gallery_event=")) > 0) {
                             $pos2 = find($url, "&", 0, $pos);
                             if ($pos2 == 0) {
                                 $url = substr($url, 0, $pos - 1);
                             } else {
                                 $url1 = substr($url, 0, $pos - 1);
                                 $url2 = substr($url, $pos2, strlen($url));
                                 $url = $url1 . $url2;
                             }
                         }
                         if (find($url, "?") > 0) {
                             $url = $url . "&";
                         } else {
                             $url = $url . "?";
                         }
                         $url = $url . "gallery_event=" . urlencode(str_replace($this->original_path, "", $this->path . $file));
                         $folder_link = new Link($url, Link::TARGET_NONE, new Object($folder_pic, "<br/>", $file));
                         $gallery_row->add($folder_link);
                         $ind++;
                     }
                 } else {
                     if ($this->in_arrayi($myExt, $this->picture_ext)) {
                         $pic_file = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path)) . "/" . $file);
                         $pic_file_lower_ext = str_replace("." . $myExt, strtolower("." . $myExt), $pic_file);
                         if ($pic_file_lower_ext != $pic_file) {
                             $path_file_lower_ext = str_replace($pic_file, $pic_file_lower_ext, str_replace("\\", "/", realpath(SITE_DIRECTORY . "/" . $pic_file)));
                             if (!rename(realpath(SITE_DIRECTORY . "/" . $pic_file), $path_file_lower_ext)) {
                                 $pic_file_lower_ext = $pic_file;
                             }
                         }
                         $pic_name = str_replace("." . $myExt, "", $file);
                         $pic_thumbnail = $pic_file_lower_ext;
                         if (trim($this->thumbnail_folder) != "") {
                             if (in_array(strtolower($myExt), array("jpg", "jpeg", "gif", "png"))) {
                                 if (!is_dir(realpath($this->path) . "/" . $this->thumbnail_folder)) {
                                     mkdir(realpath($this->path) . "/" . $this->thumbnail_folder);
                                 }
                                 $pic_thumbnail_path = realpath($this->path . "/" . $this->thumbnail_folder) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file);
                                 $pic_thumbnail = str_replace(str_replace("\\", "/", realpath(SITE_DIRECTORY)) . "/", "", str_replace("\\", "/", realpath($this->path . "/" . $this->thumbnail_folder)) . "/" . str_replace("." . $myExt, strtolower("." . $myExt), $file));
                                 if (strtolower($myExt) == "gif") {
                                     // convert to jpg
                                     $pic_thumbnail_path = str_replace(".gif", ".jpg", $pic_thumbnail_path);
                                     $pic_thumbnail = str_replace(".gif", ".jpg", $pic_thumbnail);
                                 }
                                 if (!file_exists($pic_thumbnail_path)) {
                                     if (strtolower($myExt) == "jpg" || strtolower($myExt) == "jpeg") {
                                         jpegReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
                                     } else {
                                         if (strtolower($myExt) == "png") {
                                             pngReductionFixe($pic_file_lower_ext, $pic_thumbnail_path, 128, 128);
                                         } else {
                                             $tmp_file = realpath($this->path . "/" . $this->thumbnail_folder) . "/temp.jpg";
                                             gif2jpeg($pic_file_lower_ext, $tmp_file);
                                             jpegReductionFixe($tmp_file, $pic_thumbnail_path, 128, 128);
                                             unlink($tmp_file);
                                         }
                                     }
                                 }
                             }
                         }
                         $pic = new Picture($pic_thumbnail, 128, 128, 0, Picture::ALIGN_ABSMIDDLE, $pic_name);
                         $pic->addLightbox("Lightbox" . $gallery_table->getId(), $pic_file_lower_ext, "\$(window).width()-(\$(window).width()*0.2)", "\$(window).height()-(\$(window).height()*0.2)");
                         $gallery_row->add(new Object($pic, "<br/>", $pic_name));
                         $ind++;
                     }
                 }
             }
         }
     }
     if ($gallery_row != null) {
         while ($ind % $this->nb_col != 0) {
             $gallery_row->add();
             $ind++;
         }
         $gallery_table->addRow($gallery_row);
     }
     return $gallery_table->render($ajax_render);
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:101,代码来源:PhotoGallery.class.php


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