本文整理汇总了PHP中OOMedia::getMediaByName方法的典型用法代码示例。如果您正苦于以下问题:PHP OOMedia::getMediaByName方法的具体用法?PHP OOMedia::getMediaByName怎么用?PHP OOMedia::getMediaByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OOMedia
的用法示例。
在下文中一共展示了OOMedia::getMediaByName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _formatRexMedia
function _formatRexMedia($value, $format)
{
if (!is_array($format)) {
$format = array();
}
$params = $format['params'];
// Resize aktivieren, falls nicht anders übergeben
if (empty($params['resize'])) {
$params['resize'] = true;
}
$media = OOMedia::getMediaByName($value);
// Bilder als Thumbnail
if ($media->isImage()) {
$value = $media->toImage($params);
} else {
$value = $media->toIcon();
}
return $value;
}
示例2: showList
//.........这里部分代码省略.........
// 21.04.2013: StickyNews auf Startseite priorisiert
$addSticky = $addOrderBy = "";
if ($this->id == $this->start_article_id) {
$addSticky = ',
CASE
WHEN REPLACE(stickyUntil, "-", "") > CURDATE() + 0 THEN true
ELSE false
END as st
';
$addOrderBy = 'st DESC, ';
}
$qry = 'SELECT * ' . $addSticky . '
FROM ' . TBL_NEWS . '
' . $addWhere . '
' . $addSQL . '
ORDER BY ' . $addOrderBy . 'online_date ' . $this->sort;
if ($result = mysql_query($qry)) {
$total = mysql_num_rows($result);
}
$pnum = round(ceil($total / $conf['max']), $conf['max']);
$limitStart = ($conf['page'] - 1) * $conf['max'];
$limitEnd = $conf['max'];
$qry .= ' LIMIT ' . $limitStart . ',' . $limitEnd;
$sql = new rex_sql();
if ($this->debug == 1) {
$sql->debugsql = true;
}
$data = $sql->getArray($qry);
if ($this->pagination == 1 and $total > $conf['max']) {
$pager['jumplist'] = self::drawJumplist(rex_getUrl('', '', array("page" => 'SEITENZAHL'), '&'), "<", " ", ">", $conf['page'], $pnum);
}
// http://www.redaxo.org/de/forum/addons-f30/news-addon-d-mind-t18730.html
if (!class_exists('Smarty')) {
include 'redaxo/include/addons/news/libs/Smarty.class.php';
}
$t = new Smarty();
$t->debugging = false;
$t->caching = false;
$t->cache_lifetime = 120;
$t->config_dir = 'redaxo/include/addons/news/view/configs/';
$t->compile_dir = 'redaxo/include/addons/news/view/templates_c/';
$t->cache_dir = 'redaxo/include/addons/news/view/cache/';
$t->template_dir = 'redaxo/include/addons/news/view/templates/';
if (is_array($data) && sizeof($data) > 0) {
$i = 1;
foreach ($data as $row) {
// Selbe News ausschliessen, falls in rechter Spalte Liste
if ($row['id'] == rex_request('newsid')) {
continue;
}
include "redaxo/include/addons/" . MY_PAGE . "/conf/conf.php";
if ($this->detailArticle) {
if ($REX_NEWS_CONF['rewrite'] == 1) {
$url = self::rewriteNewsUrls($row['name'], $row['id']);
} else {
$url = rex_getUrl($this->detailArticle, $this->language, array('newsid' => $row['id']), '&');
}
}
$item[$i]['id'] = $row['id'];
$item[$i]['name'] = $row['name'];
$item[$i]['url'] = $url;
$item[$i]['date'] = $this->rex_news_format_date($row['online_date'], $this->language);
$item[$i]['source'] = $row["source"];
$teaser = "";
if ($row['teaser'] != "") {
$teaser = $row['teaser'];
$item[$i]['teaser'] = $teaser;
} else {
$teaser2 = htmlspecialchars_decode($row["article"]);
$teaser2 = str_replace("<br />", "", $teaser);
$teaser2 = rex_a79_textile($teaser);
$teaser2 = str_replace("###", " ", $teaser);
$teaser2 = strip_tags($teaser);
$item[$i]['teaser'] = substr($teaser2, 0, strpos($teaser2, ".", 80) + 1);
}
$text = htmlspecialchars_decode($row["article"]);
$text = str_replace("<br />", "", $text);
$text = rex_a79_textile($text);
$text = str_replace("###", " ", $text);
$text = strip_tags($text);
$item[$i]['text'] = $text;
if ($row["thumb"] != "" and $this->images == true) {
// Bildausgabe
$images = explode(",", $row["thumb"]);
if (file_exists($REX['HTDOCS_PATH'] . 'files/' . $images[0])) {
$media = OOMedia::getMediaByName($images[0]);
if (is_array($media) and sizeof($media) > 0) {
$mediaTitle = $media->getValue('title');
$MediaDesc = $media->getValue('med_description');
}
}
$item[$i]['image'] = '<a href="' . $url . '" title="' . $row['name'] . '"><img src="index.php?rex_img_type=' . $REX_NEWS_CONF['image_list_type'] . '&rex_img_file=' . $images[0] . '" title="' . $mediaTitle . '" alt="' . $MediaDesc . '" /></a>';
}
$i++;
}
}
$t->assign("pager", $pager);
$t->assign("data", $item);
$t->display($this->template);
}
示例3: matchMedia
function matchMedia(&$sql, $content)
{
$vars = array('REX_FILE', 'REX_MEDIA');
foreach ($vars as $var) {
$matches = $this->getVarParams($content, $var);
foreach ($matches as $match) {
list($param_str, $args) = $match;
list($id, $args) = $this->extractArg('id', $args, 0);
if ($id > 0 && $id < 11) {
// Mimetype ausgeben
if (isset($args['mimetype'])) {
$OOM = OOMedia::getMediaByName($this->getValue($sql, 'file' . $id));
if ($OOM) {
$replace = $OOM->getType();
}
} else {
$replace = $this->getValue($sql, 'file' . $id);
}
$replace = $this->handleGlobalVarParams($var, $args, $replace);
$content = str_replace($var . '[' . $param_str . ']', $replace, $content);
}
}
}
return $content;
}
示例4: execute
function execute()
{
if (!$this->image->isImage()) {
return false;
}
$gdimage =& $this->image->getImage();
$w = $this->image->getWidth();
$h = $this->image->getHeight();
$filename = $this->image->getFileName();
if ($im_image = OOMedia::getMediaByName($filename)) {
$focuspoint_data = explode(",", $im_image->getValue('med_focuspoint_data'), 2);
if (count($focuspoint_data) == 2) {
// Mittelpunkt finden
$x = ceil($w / 2);
$y = ceil($h / 2);
// focusoffsets einarbeiten
$fp_w = $focuspoint_data[0];
$fp_h = $focuspoint_data[1];
// Neuen Mittelpunkt finden
$nx = $x + ceil($x * $fp_w);
$ny = $y - ceil($y * $fp_h);
// Abstand zum Rand herausfinden
$nw = $w - $nx;
// 1/2 Breite
if ($fp_w < 0) {
$nw = $nx;
// 1/2 Breite
}
$nh = $ny;
// 1/2 Breite
if ($fp_h < 0) {
$nh = $h - $ny;
// 1/2 Breite
}
$npx = $nx - $nw;
$npy = $ny - $nh;
$nw = $nw * 2;
$nh = $nh * 2;
if (function_exists('ImageCreateTrueColor')) {
$des = @ImageCreateTrueColor($nw, $nh);
} else {
$des = @ImageCreate($nw, $nh);
}
$this->keepTransparent($des);
imagecopyresampled($des, $gdimage, 0, 0, $npx, $npy, $nw, $nh, $nw, $nh);
$gdimage = $des;
$this->image->refreshDimensions();
$w = $nw;
$h = $nh;
}
}
if (!isset($this->params['style']) || !in_array($this->params['style'], $this->options)) {
$this->params['style'] = 'maximum';
}
// relatives resizen
if (substr(trim($this->params['width']), -1) === '%') {
$this->params['width'] = round($w * (rtrim($this->params['width'], '%') / 100));
}
if (substr(trim($this->params['height']), -1) === '%') {
$this->params['height'] = round($h * (rtrim($this->params['height'], '%') / 100));
}
if ($this->params['style'] == 'maximum') {
$this->resizeMax($w, $h);
} elseif ($this->params['style'] == 'minimum') {
$this->resizeMin($w, $h);
} else {
// warp => nichts tun
}
// ----- not enlarge image
if ($w <= $this->params['width'] && $h <= $this->params['height'] && $this->params['allow_enlarge'] == 'not_enlarge') {
$this->params['width'] = $w;
$this->params['height'] = $h;
$this->keepTransparent($gdimage);
return;
}
if (!isset($this->params['width'])) {
$this->params['width'] = $w;
}
if (!isset($this->params['height'])) {
$this->params['height'] = $h;
}
if (function_exists('ImageCreateTrueColor')) {
$des = @ImageCreateTrueColor($this->params['width'], $this->params['height']);
} else {
$des = @ImageCreate($this->params['width'], $this->params['height']);
}
if (!$des) {
return;
}
$this->keepTransparent($des);
imagecopyresampled($des, $gdimage, 0, 0, 0, 0, $this->params['width'], $this->params['height'], $w, $h);
$gdimage = $des;
$this->image->refreshDimensions();
}
示例5: explode
<?php
if ('REX_MEDIA[1]') {
$bild = OOMedia::getMediaByName('REX_MEDIA[1]');
$bildTitle = $bild->getTitle();
$bildDateiName = $bild->getFileName();
$bildBreite = $bild->getWidth();
$bildHoehe = $bild->getHeight();
$focuspoint_css = $bild->getValue('med_focuspoint_css');
$focuspoint_data = explode(",", $bild->getValue('med_focuspoint_data'), 2);
if (count($focuspoint_data) == 2) {
echo '
<div class="focuspoint"
data-focus-x="' . $focuspoint_data[0] . '"
data-focus-y="' . $focuspoint_data[1] . '"
data-image-w="' . $bildBreite . '"
data-image-h="' . $bildHoehe . '">
<img src="/files/' . $bildDateiName . '" alt="' . htmlspecialchars($bildTitle) . '" />
</div>
';
} else {
echo '<img src="/files/' . $bildDateiName . '" alt="' . htmlspecialchars($bildTitle) . '" />';
}
}
示例6: rex_getUrl
if ($kurs->url != "") {
$article = OOArticle::getArticleById($kurs->url, $REX['CUR_CLANG']);
print '<a href="' . rex_getUrl($kurs->url) . '">' . $article->getName() . '</a><br>';
}
if ($kurs->url_extern != "") {
print '<a href="' . $kurs->url_extern . '" target="_blank">' . $kurs->url_extern . '</a><br>';
}
print '</b></div>';
print '</div>';
}
if (count($kurs->dokumente) > 0) {
print '<div class="col-xs-12 kurs_row" data-height-watch>';
print '<div class="kurs_box abstand-box"><b>Downloads:</b> ';
print '<ul>';
foreach ($kurs->dokumente as $dokument) {
$ooDokument = OOMedia::getMediaByName($dokument);
$titel = $ooDokument->getTitle();
if ($titel == "") {
$titel = $dokument;
}
print '<li><a href="' . seo42::getMediaFile($dokument) . '" target="_blank">' . $titel . '</a></li>';
}
print '</ul>';
print '</div>';
print '</div>';
}
}
if ($kurs->anmeldung_moeglich == "ja" || $kurs->anmeldung_moeglich == "ausgebucht") {
print '</div>';
print '<div class="row">';
print '<div class="col-xs-12 col-sm-6 kurs_row" data-height-watch>';