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; }
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; }