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


PHP Images::FindByName方法代码示例

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


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

示例1: image_display

function image_display($content_to_display)
{
    $pattern_recog = array("left" => array("{", "{"), "right" => array("}", "}"), "center" => array("{", "}"));
    foreach ($pattern_recog as $float => $direction) {
        $imagePattern = "*" . $direction[0] . "{2}([A-Za-z0-9_ \\-]+)" . $direction[1] . "{2}*";
        $imageIds = getFilterIds($content_to_display, $imagePattern);
        $images = array();
        foreach ($imageIds as $imageId) {
            $images[] = Images::FindByName($imageId);
        }
        foreach ($images as $key => $image) {
            if (is_object($image)) {
                $replacement = render_hcd_img_wrapper($image, $float);
                $content_to_display = updateContent($content_to_display, "*" . $direction[0] . "{2}{$image->name}" . $direction[1] . "{2}*", $replacement);
            } else {
                $content_to_display = "<span class=\"database_error\">HCd&gt;CMS Warning: Image &ldquo;{$imageId}&rdquo; not found!</span> " . $content_to_display;
            }
        }
    }
    return $content_to_display;
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:21,代码来源:replacement.php

示例2: mail_image_display

function mail_image_display($content_to_display)
{
    $pattern_recog = array("left" => array("{", "{"), "right" => array("}", "}"), "reg" => array("{", "}"));
    foreach ($pattern_recog as $float => $direction) {
        $imagePattern = "*" . $direction[0] . "{2}([A-Za-z0-9_ \\-]+)" . $direction[1] . "{2}*";
        $imageIds = getFilterIds($content_to_display, $imagePattern);
        $images = array();
        foreach ($imageIds as $imageId) {
            if ($imageId == "random") {
                $random_image = Images::FindRandom();
                $random_image->name = "random";
                $images[] = $random_image;
            } else {
                if ($imageId == "random_cover") {
                    $random_image = Images::FindRandomCover();
                    $random_image->name = "random_cover";
                    $images[] = $random_image;
                } else {
                    $images[] = Images::FindByName($imageId);
                }
            }
        }
        foreach ($images as $key => $image) {
            if (isset($image)) {
                if (substr($image->description, 0, 7) == "http://") {
                    $replacement = "<span class=\"photo{$float}\"><a href=\"{$image->description}\"><img src=\"http://" . SITE_URL . get_link("/images/view/" . $image->id) . "\" alt=\"" . $image->title . "\" /></a>";
                    $replacement .= "<br /><a href=\"{$image->description}\">" . $image->title . "</a></span>";
                } else {
                    $replacement = "<span class=\"photo{$float}\"><img src=\"http://" . SITE_URL . get_link("/images/view/" . $image->id) . "\" alt=\"" . $image->title . "\" />";
                    if ($image->description != "") {
                        $replacement .= "<br />" . $image->description;
                    }
                    $replacement .= "</span>";
                }
                $content_to_display = updateContent($content_to_display, "*" . $direction[0] . "{2}{$image->name}" . $direction[1] . "{2}*", $replacement);
            }
        }
    }
    return $content_to_display;
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:40,代码来源:mail_config_parse.php


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