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


PHP OOMedia类代码示例

本文整理汇总了PHP中OOMedia的典型用法代码示例。如果您正苦于以下问题:PHP OOMedia类的具体用法?PHP OOMedia怎么用?PHP OOMedia使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: rex_image

 function rex_image($filepath)
 {
     global $REX;
     // ----- check params
     if (!file_exists($filepath)) {
         $this->sendError('Imagefile does not exist - ' . $filepath);
         exit;
     }
     // ----- check filesize
     $max_file_size = $REX['ADDON']['image_manager']['max_resizekb'] * 1024;
     $filesize = filesize($filepath);
     if ($filesize > $max_file_size) {
         $error = 'Imagefile is to big.';
         $error .= ' Only files < ' . $REX['ADDON']['image_manager']['max_resizekb'] . 'kb are allowed';
         $error .= '- ' . $filepath . ', ' . OOMedia::_getFormattedSize($filesize);
         $this->sendError($error);
         exit;
     }
     // ----- imagepfad speichern
     $this->img = array();
     $this->img['file'] = basename($filepath);
     $this->img['filepath'] = $filepath;
     $this->img['quality'] = $REX['ADDON']['image_manager']['jpg_quality'];
     $this->img['format'] = strtoupper(OOMedia::_getExtension($this->img['filepath']));
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:25,代码来源:class.rex_image.inc.php

示例2: isCached

 function isCached($image, $cacheParams)
 {
     if (!rex_image::isValid($image)) {
         trigger_error('Given image is not a valid rex_image', E_USER_ERROR);
     }
     $original_cache_file = $this->getCacheFile($image, $cacheParams);
     $cache_files = glob($original_cache_file . '*');
     // ----- check for cache file
     if (is_array($cache_files) && count($cache_files) == 1) {
         $cache_file = $cache_files[0];
         // time of cache
         $cachetime = filectime($cache_file);
         $imagepath = $image->getFilePath();
         if ($original_cache_file != $cache_file) {
             $image->img['format'] = strtoupper(OOMedia::_getExtension($cache_file));
             $image->img['file'] = $image->img['file'] . '.' . OOMedia::_getExtension($cache_file);
         }
         // file exists?
         if (file_exists($imagepath)) {
             $filetime = filectime($imagepath);
         } else {
             // Missing original file for cache-validation!
             $image->sendErrorImage();
         }
         // cache is newer?
         if ($cachetime > $filetime) {
             return true;
         }
     }
     return false;
 }
开发者ID:eaCe,项目名称:redaxo4,代码行数:31,代码来源:class.rex_image_cacher.inc.php

示例3: execute

 function execute()
 {
     global $REX;
     $from_path = realpath($this->image->img['filepath']);
     if (($ext = self::getExtension($from_path)) && in_array(strtolower($ext), self::$convert_types)) {
         // convert possible
         $convert_path = self::getConvertPath();
         if ($convert_path != '') {
             // convert to image and save in tmp
             $to_path = $REX['GENERATED_PATH'] . '/files/image_manager__convert2img_' . md5($this->image->img['filepath']) . '_' . $this->image->img['file'] . '.png';
             $cmd = $convert_path . ' -density 150 "' . $from_path . '[0]" -colorspace RGB "' . $to_path . '"';
             // echo $cmd;
             exec($cmd, $out, $ret);
             if ($ret != 0) {
                 return false;
             }
             $this->image->img['file'] = $this->image->img['file'] . '.png';
             $this->image->img['filepath'] = $to_path;
             $this->image->img['format'] = strtoupper(OOMedia::_getExtension($to_path));
             $this->tmp_imagepath = $to_path;
             $this->image->prepare();
         }
     } else {
         // no image
     }
     return;
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:27,代码来源:class.rex_effect_convert2img.inc.php

示例4: searchCategoryByName

 /**
  * @access public
  */
 function searchCategoryByName($name)
 {
     $query = 'SELECT id FROM ' . OOMedia::getTableName() . ' WHERE name = "' . addslashes($name) . '"';
     $sql = new sql();
     $result = $sql->get_array($query);
     $media = array();
     foreach ($result as $line) {
         $media[] = OOMediaCategory::getCategoryById($line['id']);
     }
     return $media;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:14,代码来源:class.oomediacategory.inc.php

示例5: get

 function get()
 {
     $section =& $this->getSection();
     $form = $section->getForm();
     // Buttons erst hier einfügen, da vorher die ID noch nicht vorhanden ist
     $this->addButton('Medienpool öffnen', 'javascript:openMediaPool(\'&amp;opener_form=' . $form->getName() . '&amp;opener_input_field=' . $this->getId() . '\');');
     $this->addButton('Medium entfernen', 'javascript:setValue(\'' . $this->getId() . '\',\'\');', 'file_del.gif');
     $this->addButton('Medium hinzufügen', 'javascript:openMediaPool(\'&amp;action=media_upload&amp;subpage=add_file&amp;opener_form=' . $form->getName() . '&amp;opener_input_field=' . $this->getId() . '\');', 'file_add.gif');
     $preview = '';
     if ($this->isPreviewEnabled() && $this->getValue() != '' && OOMedia::_isImage($this->getValue())) {
         $preview = '<img class="preview" src="' . $this->previewUrl($this->getValue()) . '" />';
     }
     return $preview . parent::get();
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-addons,代码行数:14,代码来源:field.rexMediaButtonField.inc.php

示例6: rex_image

 function rex_image($filepath)
 {
     global $REX;
     // ----- check params
     if (!file_exists($filepath)) {
         // 'Imagefile does not exist - '. $filepath
         $this->sendErrorImage();
     }
     // ----- imagepfad speichern
     $this->img = array();
     $this->img['file'] = basename($filepath);
     $this->img['filepath'] = $filepath;
     $this->img['quality'] = $REX['ADDON']['image_manager']['jpg_quality'];
     $this->img['format'] = strtolower(OOMedia::_getExtension($this->img['filepath']));
 }
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:15,代码来源:class.rex_image.inc.php

示例7: rex_thumbnail

 function rex_thumbnail($imgfile)
 {
     global $REX;
     // ----- imagepfad speichern
     $this->img = array();
     $this->imgfile = $imgfile;
     // ----- gif support ?
     $this->gifsupport = function_exists('imageGIF');
     // ----- detect image format
     $this->img['format'] = strtoupper(OOMedia::_getExtension($imgfile));
     $this->img['src'] = false;
     if (strpos($imgfile, 'cache/') === false) {
         if ($this->img['format'] == 'JPG' || $this->img['format'] == 'JPEG') {
             // --- JPEG
             $this->img['format'] = 'JPEG';
             $this->img['src'] = @ImageCreateFromJPEG($imgfile);
         } elseif ($this->img['format'] == 'PNG') {
             // --- PNG
             $this->img['src'] = @ImageCreateFromPNG($imgfile);
         } elseif ($this->img['format'] == 'GIF') {
             // --- GIF
             if ($this->gifsupport) {
                 $this->img['src'] = @ImageCreateFromGIF($imgfile);
             }
         } elseif ($this->img['format'] == 'WBMP') {
             // --- WBMP
             $this->img['src'] = @ImageCreateFromWBMP($imgfile);
         }
         // ggf error image senden
         if (!$this->img['src']) {
             $this->sendError();
             exit;
         }
         $this->img['width'] = imagesx($this->img['src']);
         $this->img['height'] = imagesy($this->img['src']);
         $this->img['width_offset_thumb'] = 0;
         $this->img['height_offset_thumb'] = 0;
         // --- default quality jpeg
         $this->img['quality'] = $REX['ADDON']['image_resize']['jpg_quality'];
         $this->filters = array();
     }
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:42,代码来源:class.thumbnail.inc.php

示例8: securefile

function securefile($_params)
{
    global $REX;
    $myself = 'xmediapool_password';
    $m = OOMedia::getMediaByFilename($_params['filename']);
    $password = $m->getValue('med_' . $myself . '_password');
    // htaccess-Datei auslesen
    $htaccess_path = rtrim($REX['MEDIAFOLDER'], '/\\') . '/.htaccess';
    $htaccess = '';
    if (file_exists($htaccess_path)) {
        $htaccess = file_get_contents($htaccess_path);
    }
    // RewriteBase ermitteln
    $base = trim(str_replace('\\', '/', substr(realpath($REX['MEDIAFOLDER']), strlen(realpath($_SERVER['DOCUMENT_ROOT'])))), '/');
    $frontend = str_replace('//', '/', '/' . trim(str_replace('\\', '/', substr(realpath($REX['FRONTEND_PATH']), strlen(realpath($_SERVER['DOCUMENT_ROOT'])))), '/') . '/');
    $lines = array();
    $lines[] = "RewriteEngine On\nRewriteBase /" . $base;
    // vorhandene Passwort geschützte Dateien auslesen
    $already_secured = false;
    if (preg_match_all('~^RewriteRule \\^(.*)\\$\\s.*$~im', $htaccess, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $match) {
            // Wenn bei einer Datei ein Passwort gelöscht wurde, dann diese Datei nicht mehr schützen
            if ($match[1] == preg_quote($_params['filename'], '~')) {
                if (!strlen($password)) {
                    continue;
                } else {
                    $already_secured = true;
                }
            }
            $lines[] = sprintf('RewriteRule ^%s$ http://%%{HTTP_HOST}%s%s [R=302,L]', $match[1], $frontend, ltrim(rex_geturl($REX['ADDON']['DOWNLOAD_FORM_ARTICLE_ID'][$myself], '', array($myself . '_filename' => stripslashes($match[1])), '&'), '/'));
        }
    }
    // neue passwortgeschützte Datei hinzufügen
    if (!$already_secured and strlen($password)) {
        $lines[] = sprintf('RewriteRule ^%s$ http://%%{HTTP_HOST}/%s%s [R=302,L]', preg_quote($_params['filename'], '~'), $frontend, ltrim(rex_geturl($REX['ADDON']['DOWNLOAD_FORM_ARTICLE_ID'][$myself], '', array($myself . '_filename' => $_params['filename']), '&'), '/'));
    }
    // Daten in die htaccess-Datei schreiben
    file_put_contents($htaccess_path, implode("\n", $lines));
}
开发者ID:olien,项目名称:xmediapool_password,代码行数:39,代码来源:config.inc.php

示例9: fire

 /**
  * Execute the search for the given SearchCommand
  *
  * @param  SearchCommand $search
  * @return SearchResult
  */
 public function fire(SearchCommand $search)
 {
     $search_result = new SearchResult();
     $fields = array('filename', 'title');
     $s = \rex_sql::factory();
     $s->setQuery('SELECT * FROM ' . Watson::getTable('file') . ' LIMIT 0');
     $fieldnames = $s->getFieldnames();
     foreach ($fieldnames as $fieldname) {
         if (substr($fieldname, 0, 4) == 'med_') {
             $fields[] = $fieldname;
         }
     }
     $sql_query = ' SELECT      filename,
                                 title
                     FROM        ' . Watson::getTable('file') . '
                     WHERE       ' . $search->getSqlWhere($fields) . '
                     ORDER BY    filename';
     $results = $this->getDatabaseResults($sql_query);
     if (count($results)) {
         foreach ($results as $result) {
             $title = $result['title'] != '' ? ' (' . Watson::translate('watson_media_title') . ': ' . $result['title'] . ')' : '';
             $entry = new SearchResultEntry();
             $entry->setValue($result['filename']);
             $entry->setDescription(Watson::translate('watson_open_media') . $title);
             $entry->setIcon('icon_media.png');
             $entry->setUrl('javascript:newPoolWindow(\'' . Watson::getUrl(array('page' => 'mediapool', 'subpage' => 'detail', 'file_name' => $result['filename'])) . '\')');
             $m = \OOMedia::getMediaByFileName($result['filename']);
             if ($m instanceof \OOMedia) {
                 if ($m->isImage()) {
                     $entry->setQuickLookUrl(Watson::getUrl(array('rex_img_type' => 'rex_mediapool_maximized', 'rex_img_file' => $result['filename'])));
                 }
             }
             $search_result->addEntry($entry);
         }
     }
     return $search_result;
 }
开发者ID:VIEWSION,项目名称:redaxo_watson,代码行数:43,代码来源:MediaSearch.php

示例10: getImageTag

 public static function getImageTag($imageFile, $imageType = '', $width = 0, $height = 0)
 {
     $media = OOMedia::getMediaByFileName($imageFile);
     // make sure media object is valid
     if (OOMedia::isValid($media)) {
         $mediaWidth = $media->getWidth();
         $mediaHeight = $media->getHeight();
         $altAttribute = $media->getTitle();
     } else {
         $mediaWidth = '';
         $mediaHeight = '';
         $altAttribute = '';
     }
     // image width
     if ($width == 0) {
         $imgWidth = $mediaWidth;
     } else {
         $imgWidth = $width;
     }
     // image height
     if ($height == 0) {
         $imgHeight = $mediaHeight;
     } else {
         $imgHeight = $height;
     }
     // get url
     if ($imageType == '') {
         $url = self::getMediaFile($imageFile);
     } else {
         $url = self::getImageManagerFile($imageFile, $imageType);
     }
     return '<img src="' . $url . '" width="' . $imgWidth . '" height="' . $imgHeight . '" alt="' . $altAttribute . '" />';
 }
开发者ID:ReggaePanda,项目名称:seo42,代码行数:33,代码来源:class.seo42.inc.php

示例11: 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'), '&amp;'), "&lt;", " ", "&gt;", $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']), '&amp;');
                    }
                }
                $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("###", "&#x20;", $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("###", "&#x20;", $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'] . '&amp;rex_img_file=' . $images[0] . '" title="' . $mediaTitle . '" alt="' . $MediaDesc . '" /></a>';
                }
                $i++;
            }
        }
        $t->assign("pager", $pager);
        $t->assign("data", $item);
        $t->display($this->template);
    }
开发者ID:brt-tito,项目名称:rex-news,代码行数:101,代码来源:class.336news.inc.php

示例12: elseif

<?php

// module: magnific_popup_image_out
$imageType = 'magnific_popup_image_thumb';
$imageFile = 'REX_MEDIA[1]';
if ($imageFile != '') {
    $media = OOMedia::getMediaByFilename($imageFile);
    // get title and description
    if (OOMedia::isValid($media)) {
        $title = $media->getValue('title');
        $description = $media->getValue('med_description');
    } else {
        $title = '';
        $description = '';
    }
    // get media dir
    if (isset($REX['MEDIA_DIR'])) {
        $mediaDir = $REX['MEDIA_DIR'];
    } else {
        $mediaDir = 'files';
    }
    // generate image manager url
    if (method_exists('seo42', 'getImageManagerFile')) {
        $imageManagerUrl = seo42::getImageManagerFile($imageFile, $imageType);
        $imageUrl = seo42::getMediaDir() . $imageFile;
    } elseif (method_exists('seo42', 'getImageManagerUrl')) {
        // compat
        $imageManagerUrl = seo42::getImageManagerUrl($imageFile, $imageType);
        $imageUrl = seo42::getMediaDir() . $imageFile;
    } else {
        $imageUrl = $REX['HTDOCS_PATH'] . $mediaDir . '/' . $imageFile;
开发者ID:darwin26,项目名称:magnific_popup,代码行数:31,代码来源:output.php

示例13: rex_mediapool_isAllowedMediaType

/**
 * check if mediatpye(extension) is allowed for upload
 *
 * @param string $filename
 * @param array  $args
 * @return  bool
 */
function rex_mediapool_isAllowedMediaType($filename, $args = array())
{
    $file_ext = '.' . OOMedia::_getExtension($filename);
    if ($filename === '' || strpos($file_ext, ' ') !== false || $file_ext === '.') {
        return false;
    }
    $blacklist = rex_mediapool_getMediaTypeBlacklist();
    $whitelist = rex_mediapool_getMediaTypeWhitelist($args);
    if (in_array($file_ext, $blacklist)) {
        return false;
    }
    if (count($whitelist) > 0 && !in_array($file_ext, $whitelist)) {
        return false;
    }
    return true;
}
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:23,代码来源:function_rex_mediapool.inc.php

示例14: _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;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:19,代码来源:class.rex_formatter.inc.php

示例15: rex_mediapool_saveMedia

     $rex_file_category = 0;
 }
 // function in function.rex_mediapool.inc.php
 $return = rex_mediapool_saveMedia($_FILES['file_new'], $rex_file_category, $FILEINFOS, $REX['USER']->getValue("login"));
 $info = $return['msg'];
 $subpage = "";
 // ----- EXTENSION POINT
 if ($return['ok'] == 1) {
     rex_register_extension_point('MEDIA_ADDED', '', $return);
 }
 if (rex_post('saveandexit', 'boolean') && $return['ok'] == 1) {
     $file_name = $return['filename'];
     $ffiletype = $return['type'];
     $title = $return['title'];
     if ($opener_input_field == 'TINYIMG') {
         if (OOMedia::_isImage($file_name)) {
             $js = "insertImage('{$file_name}','{$title}');";
         }
     } elseif ($opener_input_field == 'TINY') {
         $js = "insertLink('" . $file_name . "');";
     } elseif ($opener_input_field != '') {
         if (substr($opener_input_field, 0, 14) == "REX_MEDIALIST_") {
             $js = "selectMedialist('" . $file_name . "');";
         } else {
             $js = "selectMedia('" . $file_name . "');";
         }
     }
     echo "<script language=javascript>\n";
     echo $js;
     // echo "\nself.close();\n";
     echo "</script>";
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:31,代码来源:mediapool.upload.inc.php


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