0

我不知道从哪里开始显示文件集中的文件,以便在点击时显示一个花式画廊。我想从链接打开画廊。单击时显示图库,即具有相同 rel 但设置为 display:none 的图像(由我的 css 轻松控制)。我可以通过选择一个图像来做到这一点,但不确定如何将图像从文件集中传递到视图中(我假设我需要在我的控制器中创建某种函数来获取 fsID,只是不确定如何) . 我只需要在页面上显示第一张图像(缩略图),然后单击链接,它会显示更多全尺寸图像。

基本上,如果你知道 Concrete5,我希望它像图像块一样,除了管理员可以选择一个文件集而不是一个图像。

这是我的view.php

$picture = $this->controller->getPicture();
if ($picture) {
    $bigPicture = $image->getThumbnail($picture,600,600)->src;
    $smallPicture = $image->getThumbnail($picture,200,200)->src;

    echo "<img src=" . $smallPicture . " alt=" . $imageTitle . " title=" . $imageTitle . "/>";//thumbnail picture
echo "<div id=\"image-modal\">";
echo "<a href=" . $bigPicture . " class=\"fancybox-thumb\" rel=" . $title . " title=" . $imageTitle . ">{$linkText}</a>";//open fancybox from link
echo "<div class=\"hiddenGallery\"  style=\"display:none;\">";//hidden images
    echo "<a href=\"images/pattern/t-103-n.jpg\" class=\"fancybox-thumb\" rel=" . $title . " title=" . $imageTitle . ">";
echo "<img src=\"images/pattern/t-103-n.jpg\" class=\"fancybox-thumb\" />";
echo "</a>";
    echo "</div>";
echo "</div>";
}

我的控制器.php

function getPicture() {
        if ($this->fIDpicture > 0) {
            return File::getByID($this->fIDpicture);
        }
        return null;
    }

我的 add.php

$al = Loader::helper('concrete/asset_library');
echo $al->image('ccm-b-image', 'fIDpicture', t('Choose File'),
    $this->controller->getPicture());
echo '</div>';

非常感谢任何和所有帮助。

4

2 回答 2

0

我有一些代码可以处理这个等式的整个后端(添加/编辑/控制器)部分: https ://github.com/jordanlev/c5_designer_gallery

这是一个解释如何使用它的教程(以 FlexSlider 为例,但如果你知道 Fancybox 是如何工作的,那么它应该不难理解发生了什么): http ://c5blog.jordanlev.com/blog/ 2011/12/建立幻灯片块/

于 2013-03-07T15:53:01.297 回答
0

好吧,有两件事:

  • 您必须将class="fancybox-thumb"ANDrel属性设置为<a>标签!!,而不是<img />标签。
  • 如果您打算隐藏画廊的其余元素,请不要display: none;为每个元素设置 css 属性,而是将它们包装在一个隐藏的<div>容器中,例如:

    <div style="display: none;">
      <a class="fancybox-thumb" rel="gallery" href="images/02.jpg"></a>
      <a class="fancybox-thumb" rel="gallery" href="images/03.jpg"></a>
      <a class="fancybox-thumb" rel="gallery" href="images/04.jpg"></a>
      ... etc
    </div>
    

我正在使用渲染的 html,这很重要。

于 2013-02-27T05:52:07.930 回答