本文整理匯總了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>CMS Warning: Image “{$imageId}” not found!</span> " . $content_to_display;
}
}
}
return $content_to_display;
}
示例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;
}