本文整理匯總了PHP中rex_url::media方法的典型用法代碼示例。如果您正苦於以下問題:PHP rex_url::media方法的具體用法?PHP rex_url::media怎麽用?PHP rex_url::media使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rex_url
的用法示例。
在下文中一共展示了rex_url::media方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: toImage
/**
* @param array $params
*
* @return string
*/
public function toImage(array $params = [])
{
if (!$this->isImage()) {
return '';
}
$filename = rex_url::media($this->getFileName());
$title = $this->getTitle();
if (!isset($params['alt'])) {
if ($title != '') {
$params['alt'] = htmlspecialchars($title);
}
}
if (!isset($params['title'])) {
if ($title != '') {
$params['title'] = htmlspecialchars($title);
}
}
rex_extension::registerPoint(new rex_extension_point('MEDIA_TOIMAGE', '', ['filename' => &$filename, 'params' => &$params]));
$additional = '';
foreach ($params as $name => $value) {
$additional .= ' ' . $name . '="' . $value . '"';
}
return sprintf('<img src="%s"%s />', $filename, $additional);
}
示例2: show_form_info
public static function show_form_info($media)
{
$file_id = rex_request('file_id', 'int');
echo '
<style>
.helper-tool, .helper-tool * {
box-sizing:border-box;
}
.helper-tool {
padding:12px;
border:1px solid #fcfcfc;
}
.helper-tool input {
position:relative;
width:100%;
}
/* !HELPER TOOL TARGETING SYSTEM */
.focuspoint img {
transition: all 500ms ease-in-out;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
}
/* !HELPER TOOL TARGETING SYSTEM */
.helper-tool-target {
position: relative;
display: inline-block;
overflow: hidden;
margin-bottom:1em;
}
.helper-tool-target img {
position: relative;
display: block;
max-width: 100%;
height:auto;
}
.helper-tool-target img.target-overlay, .helper-tool-target img.reticle {
position: absolute;
top: 0;
left: 0;
}
.helper-tool-target img.target-overlay {
top: 0 !important;
left: 0 !important;
cursor:pointer;
opacity: 0.0;
}
.helper-tool-target img.reticle {
width: 102px;
height: 102px;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
transition: all 500ms ease-in-out;
-webkit-transition: all 500ms ease-in-out;
-moz-transition: all 500ms ease-in-out;
}
</style>
';
$vars = rex_sql::factory()->getArray('select * from rex_media where id=' . $file_id);
$saved_css_data = explode(",", $vars[0]['med_focuspoint_css'], 2);
$css_x = '';
$css_y = '';
if (count($saved_css_data) == 2) {
$css_x = $saved_css_data[0];
$css_y = $saved_css_data[1];
}
echo '
<style>
.helper-tool-target img.target-overlay, .helper-tool-target img.reticle {
top: ' . $css_y . ';
left: ' . $css_x . ';
}
</style>
';
$filename = $vars[0]['filename'];
$dateiart = substr($filename, -3);
if ($dateiart == 'jpg' or $dateiart == 'png' or $dateiart == 'gif') {
$html = '<div class="rex-mediapool-detail-image col-sm-4"><div id="fwidth" class="helper-tool-target"><img class="helper-tool-img" src="index.php?rex_media_type=rex_mediapool_maximized&rex_media_file=' . rex_url::media($filename) . '" ><img class="reticle" src="./../assets/addons/focuspoint/focuspoint-target.png"><img class="target-overlay" src="index.php?rex_media_type=rex_mediapool_maximized&rex_media_file=' . rex_url::media($filename) . '" ></div></div>';
echo "\n <script>\n \$(document).on('ready pjax:success',function(){\n \$('.panel-body .col-sm-4').replaceWith('{$html}');\n\n \$('img').click(function(e){\n\n var imageW = \$(this).width();\n var imageH = \$(this).height();\n\n //Calculate FocusPoint coordinates\n var offsetX = e.pageX - \$(this).offset().left;\n var offsetY = e.pageY - \$(this).offset().top;\n var focusX = (offsetX/imageW - .5)*2;\n var focusY = (offsetY/imageH - .5)*-2;\n\n //Calculate CSS Percentages\n var percentageX = (offsetX/imageW)*100;\n var percentageY = (offsetY/imageH)*100;\n var backgroundPositionCSS = percentageX.toFixed(0) + '%, ' + percentageY.toFixed(0) + '%';\n\n \$('#Focuspoint_Data' ).val(focusX.toFixed(2) + ',' + focusY.toFixed(2));\n \$('#Focuspoint_CSS' ).val(backgroundPositionCSS);\n\n \$('.reticle').css({\n 'top':percentageY+'%',\n 'left':percentageX+'%'\n });\n\n\n // window.alert('FocusX:' + focusX.toFixed(2) + ', FocusY:' + focusY.toFixed(2) + ' (For CSS version: ' + backgroundPositionCSS + ')');\n\n });\n\n });\n\n </script>\n ";
}
}
示例3: insertImage
?>
}
function insertImage(src,alt)
{
window.opener.insertImage("<?php
echo rex_url::media();
?>
" + src, alt);
self.close();
}
function insertLink(src)
{
window.opener.insertFileLink("<?php
echo rex_url::media();
?>
" + src);
self.close();
}
function openPage(src)
{
window.opener.location.href = src;
self.close();
}
//-->
</script>
<?php
// -------------- Include Page
示例4: htmlspecialchars
$desc = '<p>' . htmlspecialchars($files->getValue($col)) . '</p>';
break;
}
}
// wenn datei fehlt
if (!file_exists(rex_path::media($file_name))) {
$thumbnail = '<i class="rex-mime rex-mime-error" title="' . rex_i18n::msg('pool_file_does_not_exist') . '"></i><span class="sr-only">' . $file_name . '</span>';
} else {
$file_ext = substr(strrchr($file_name, '.'), 1);
$icon_class = ' rex-mime-default';
if (rex_media::isDocType($file_ext)) {
$icon_class = ' rex-mime-' . $file_ext;
}
$thumbnail = '<i class="rex-mime' . $icon_class . '" title="' . $alt . '" data-extension="' . $file_ext . '"></i><span class="sr-only">' . $file_name . '</span>';
if (rex_media::isImageType(rex_file::extension($file_name)) && $thumbs) {
$thumbnail = '<img class="thumbnail" src="' . rex_url::media($file_name) . '" alt="' . $alt . '" title="' . $alt . '" />';
if ($media_manager) {
$thumbnail = '<img class="thumbnail" src="' . rex_url::backendController(['rex_media_type' => 'rex_mediapool_preview', 'rex_media_file' => $encoded_file_name]) . '" alt="' . $alt . '" title="' . $alt . '" />';
}
}
}
// ----- get file size
$size = $file_size;
$file_size = rex_formatter::bytes($size);
if ($file_title == '') {
$file_title = '[' . rex_i18n::msg('pool_file_notitle') . ']';
}
$file_title .= ' [' . $file_id . ']';
// ----- opener
$opener_link = '';
if ($opener_input_field == 'TINYIMG') {
示例5: getMediaUrl
public function getMediaUrl($index)
{
return rex_url::media($this->getMedia($index));
}