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


PHP Linker::processResponsiveImages方法代码示例

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


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

示例1: openShowImage


//.........这里部分代码省略.........
                        // the current thumbnail's size ($width/$height)
                        // since that is added to the message separately, so
                        // it can be denoted as the current size being shown.
                        if ($size[0] <= $width_orig && $size[1] <= $height_orig && $size[0] != $width && $size[1] != $height) {
                            $sizeLink = $this->makeSizeLink($params, $size[0], $size[1]);
                            if ($sizeLink) {
                                $otherSizes[] = $sizeLink;
                            }
                        }
                    }
                    $otherSizes = array_unique($otherSizes);
                    $msgsmall = '';
                    $sizeLinkBigImagePreview = $this->makeSizeLink($params, $width, $height);
                    if ($sizeLinkBigImagePreview) {
                        $msgsmall .= wfMessage('show-big-image-preview')->rawParams($sizeLinkBigImagePreview)->parse();
                    }
                    if (count($otherSizes)) {
                        $msgsmall .= ' ' . Html::rawElement('span', array('class' => 'mw-filepage-other-resolutions'), wfMessage('show-big-image-other')->rawParams($lang->pipeList($otherSizes))->params(count($otherSizes))->parse());
                    }
                } elseif ($width == 0 && $height == 0) {
                    # Some sort of audio file that doesn't have dimensions
                    # Don't output a no hi res message for such a file
                    $msgsmall = '';
                } elseif ($this->displayImg->isVectorized()) {
                    # For vectorized images, full size is just the frame size
                    $msgsmall = '';
                } else {
                    # Image is small enough to show full size on image page
                    $msgsmall = wfMessage('file-nohires')->parse();
                }
                $params['width'] = $width;
                $params['height'] = $height;
                $thumbnail = $this->displayImg->transform($params);
                Linker::processResponsiveImages($this->displayImg, $thumbnail, $params);
                $anchorclose = Html::rawElement('div', array('class' => 'mw-filepage-resolutioninfo'), $msgsmall);
                $isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
                if ($isMulti) {
                    $out->addModules('mediawiki.page.image.pagination');
                    $out->addHTML('<table class="multipageimage"><tr><td>');
                }
                if ($thumbnail) {
                    $options = array('alt' => $this->displayImg->getTitle()->getPrefixedText(), 'file-link' => true);
                    $out->addHTML('<div class="fullImageLink" id="file">' . $thumbnail->toHtml($options) . $anchorclose . "</div>\n");
                }
                if ($isMulti) {
                    $count = $this->displayImg->pageCount();
                    if ($page > 1) {
                        $label = $out->parse(wfMessage('imgmultipageprev')->text(), false);
                        // on the client side, this link is generated in ajaxifyPageNavigation()
                        // in the mediawiki.page.image.pagination module
                        $link = Linker::linkKnown($this->getTitle(), $label, array(), array('page' => $page - 1));
                        $thumb1 = Linker::makeThumbLinkObj($this->getTitle(), $this->displayImg, $link, $label, 'none', array('page' => $page - 1));
                    } else {
                        $thumb1 = '';
                    }
                    if ($page < $count) {
                        $label = wfMessage('imgmultipagenext')->text();
                        $link = Linker::linkKnown($this->getTitle(), $label, array(), array('page' => $page + 1));
                        $thumb2 = Linker::makeThumbLinkObj($this->getTitle(), $this->displayImg, $link, $label, 'none', array('page' => $page + 1));
                    } else {
                        $thumb2 = '';
                    }
                    global $wgScript;
                    $formParams = array('name' => 'pageselector', 'action' => $wgScript);
                    $options = array();
                    for ($i = 1; $i <= $count; $i++) {
开发者ID:Tarendai,项目名称:spring-website,代码行数:67,代码来源:ImagePage.php

示例2: toHTML

 /**
  * Return a HTML representation of the image gallery
  *
  * For each image in the gallery, display
  * - a thumbnail
  * - the image name
  * - the additional text provided when adding the image
  * - the size of the image
  *
  * @return string
  */
 function toHTML()
 {
     if ($this->mPerRow > 0) {
         $maxwidth = $this->mPerRow * ($this->mWidths + $this->getAllPadding());
         $oldStyle = isset($this->mAttribs['style']) ? $this->mAttribs['style'] : '';
         # _width is ignored by any sane browser. IE6 doesn't know max-width
         # so it uses _width instead
         $this->mAttribs['style'] = "max-width: {$maxwidth}px;_width: {$maxwidth}px;" . $oldStyle;
     }
     $attribs = Sanitizer::mergeAttributes(['class' => 'gallery mw-gallery-' . $this->mMode], $this->mAttribs);
     $modules = $this->getModules();
     if ($this->mParser) {
         $this->mParser->getOutput()->addModules($modules);
         $this->mParser->getOutput()->addModuleStyles('mediawiki.page.gallery.styles');
     } else {
         $this->getOutput()->addModules($modules);
         $this->getOutput()->addModuleStyles('mediawiki.page.gallery.styles');
     }
     $output = Xml::openElement('ul', $attribs);
     if ($this->mCaption) {
         $output .= "\n\t<li class='gallerycaption'>{$this->mCaption}</li>";
     }
     if ($this->mShowFilename) {
         // Preload LinkCache info for when generating links
         // of the filename below
         $lb = new LinkBatch();
         foreach ($this->mImages as $img) {
             $lb->addObj($img[0]);
         }
         $lb->execute();
     }
     $lang = $this->getRenderLang();
     # Output each image...
     foreach ($this->mImages as $pair) {
         /** @var Title $nt */
         $nt = $pair[0];
         $text = $pair[1];
         # "text" means "caption" here
         $alt = $pair[2];
         $link = $pair[3];
         $descQuery = false;
         if ($nt->getNamespace() === NS_FILE) {
             # Get the file...
             if ($this->mParser instanceof Parser) {
                 # Give extensions a chance to select the file revision for us
                 $options = [];
                 Hooks::run('BeforeParserFetchFileAndTitle', [$this->mParser, $nt, &$options, &$descQuery]);
                 # Fetch and register the file (file title may be different via hooks)
                 list($img, $nt) = $this->mParser->fetchFileAndTitle($nt, $options);
             } else {
                 $img = wfFindFile($nt);
             }
         } else {
             $img = false;
         }
         $params = $this->getThumbParams($img);
         // $pair[4] is per image handler options
         $transformOptions = $params + $pair[4];
         $thumb = false;
         if (!$img) {
             # We're dealing with a non-image, spit out the name and be done with it.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . htmlspecialchars($nt->getText()) . '</div>';
             if ($this->mParser instanceof Parser) {
                 $this->mParser->addTrackingCategory('broken-file-category');
             }
         } elseif ($this->mHideBadImages && wfIsBadImage($nt->getDBkey(), $this->getContextTitle())) {
             # The image is blacklisted, just show it as a text link.
             $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . Linker::linkKnown($nt, htmlspecialchars($nt->getText())) . '</div>';
         } else {
             $thumb = $img->transform($transformOptions);
             if (!$thumb) {
                 # Error generating thumbnail.
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="height: ' . ($this->getThumbPadding() + $this->mHeights) . 'px;">' . htmlspecialchars($img->getLastError()) . '</div>';
             } else {
                 /** @var MediaTransformOutput $thumb */
                 $vpad = $this->getVPad($this->mHeights, $thumb->getHeight());
                 $imageParameters = ['desc-link' => true, 'desc-query' => $descQuery, 'alt' => $alt, 'custom-url-link' => $link];
                 // In the absence of both alt text and caption, fall back on
                 // providing screen readers with the filename as alt text
                 if ($alt == '' && $text == '') {
                     $imageParameters['alt'] = $nt->getText();
                 }
                 $this->adjustImageParameters($thumb, $imageParameters);
                 Linker::processResponsiveImages($img, $thumb, $transformOptions);
                 # Set both fixed width and min-height.
                 $thumbhtml = "\n\t\t\t" . '<div class="thumb" style="width: ' . $this->getThumbDivWidth($thumb->getWidth()) . 'px;">' . '<div style="margin:' . $vpad . 'px auto;">' . $thumb->toHtml($imageParameters) . '</div></div>';
                 // Call parser transform hook
                 /** @var MediaHandler $handler */
                 $handler = $img->getHandler();
//.........这里部分代码省略.........
开发者ID:claudinec,项目名称:galan-wiki,代码行数:101,代码来源:TraditionalImageGallery.php

示例3: processResponsiveImages

 public function processResponsiveImages($file, $thumb, $hp)
 {
     Linker::processResponsiveImages($file, $thumb, $hp);
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:4,代码来源:DummyLinker.php


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