當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。