1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 05:09:05 +01:00

imageselector/preview shortcodes small improvements (full rewrite is coming when media manager is ready)

This commit is contained in:
secretr 2009-11-28 15:31:08 +00:00
parent 5d3aaaa541
commit a077817d7b
2 changed files with 16 additions and 8 deletions

View File

@ -1,7 +1,5 @@
// $Id: imagepreview.sc,v 1.3 2009-11-18 09:32:31 secretr Exp $
global $e107;
// $Id: imagepreview.sc,v 1.4 2009-11-28 15:31:08 secretr Exp $
list($name, $width, $height) = explode("|",$parm, 3);
$name = varset($name);//avoid warnings
@ -9,10 +7,18 @@ if(varset($width))
{
$width = " width: {$width};";
}
else $width = '';
if(varset($height))
{
$height = " height: {$height};";
}
else $height = '';
$path = (varset($_POST[$name]) && defsettrue('e_AJAX_REQUEST')) ? e107::getParser()->replaceConstants($_POST[$name], 'full') : '';
$hide = '';
$path = (varset($_POST[$name]) && defsettrue('e_AJAX_REQUEST')) ? $e107->tp->replaceConstants($_POST[$name], 'full') : e_IMAGE_ABS."generic/blank.gif";
return "<a href='{$path}' rel='external' class='e-image-preview'><img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}' /></a>";
if(!$path)
{
$path = e_IMAGE_ABS."generic/blank.gif";
$hide = 'display: none;';
}
return "<a href='{$path}' rel='external' class='e-image-preview'><img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}{$hide}' /></a>";

View File

@ -1,5 +1,5 @@
// $Id: imageselector.sc,v 1.10 2009-11-18 09:32:31 secretr Exp $
// $Id: imageselector.sc,v 1.11 2009-11-28 15:31:08 secretr Exp $
//FIXME - full rewrite, backward compatible
global $sql,$parm,$tp;
@ -87,9 +87,11 @@ if($scaction == 'select' || $scaction == 'all')
if($scaction == 'select') return $text;
}
$hide = '';
if(!$pvw_default)
{
$pvw_default = ($default) ? $path.$default : e_IMAGE_ABS."generic/blank.gif";
$hide = 'display: none;';
}
@ -104,9 +106,9 @@ else
{
$text .= "<a href='{$pvw_default}' rel='external' class='e-image-preview'>";
}
if(vartrue($height)) $height = "height:{$height}";
if(vartrue($height)) $height = "height:{$height};";
if(vartrue($width)) $width = "width:{$width}; ";
$text .= "<img src='{$pvw_default}' alt='' style='{$width}{$height}' /></a>";
$text .= "<img src='{$pvw_default}' alt='' style='{$width}{$height}{$hide}' /></a>";
$text .= "</div>\n";