mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 06:07:32 +02:00
IN PROGRESS - Task EONE-10: thumb support added to imagepreview/imageselector shortcodes
This commit is contained in:
@@ -3,19 +3,19 @@
|
|||||||
|
|
||||||
function imagepreview_shortcode($parm)
|
function imagepreview_shortcode($parm)
|
||||||
{
|
{
|
||||||
list($name, $width, $height) = explode("|",$parm, 3);
|
list($name, $width, $height, $nothumb) = explode("|",$parm, 4);
|
||||||
|
|
||||||
$name = rawurldecode(varset($name));//avoid warnings
|
$name = rawurldecode(varset($name));//avoid warnings
|
||||||
if(varset($width))
|
if(varset($width))
|
||||||
{
|
{
|
||||||
$width = " width: {$width};";
|
$width = intval($width);
|
||||||
}
|
}
|
||||||
else $width = '';
|
else $width = 0;
|
||||||
if(varset($height))
|
if(varset($height))
|
||||||
{
|
{
|
||||||
$height = " height: {$height};";
|
$height = intval($height);
|
||||||
}
|
}
|
||||||
else $height = '';
|
else $height = 0;
|
||||||
|
|
||||||
// array support
|
// array support
|
||||||
if(strpos($name, '[')) //can't be first string
|
if(strpos($name, '[')) //can't be first string
|
||||||
@@ -48,8 +48,13 @@ function imagepreview_shortcode($parm)
|
|||||||
|
|
||||||
if(!$path)
|
if(!$path)
|
||||||
{
|
{
|
||||||
$path = e_IMAGE_ABS."generic/blank.gif";
|
$path = '#';
|
||||||
|
$thpath = e_IMAGE_ABS."generic/blank.gif";
|
||||||
$hide = ' style="display: none;"';
|
$hide = ' style="display: none;"';
|
||||||
}
|
}
|
||||||
return "<a href='{$path}' rel='external' class='e-image-preview'{$hide}><img src='{$path}' alt=\"\" class='image-selector' style='{$width}{$height}' /></a>";
|
else
|
||||||
|
{
|
||||||
|
$thpath = !varset($nothumb) ? e107::getParser()->thumbUrl($path, 'w='.$width.'h='.$height, true) : $path;
|
||||||
|
}
|
||||||
|
return "<a href='{$path}' rel='external' class='e-image-preview'{$hide}><img src='{$thpath}' alt=\"\" class='image-selector' /></a>";
|
||||||
}
|
}
|
@@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
// $Id$
|
// $Id$
|
||||||
//FIXME - full rewrite, backward compatible
|
//FIXME - full rewrite, backward compatible
|
||||||
global $sql,$parm,$tp;
|
|
||||||
|
$sql = e107::getDb();
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if(strstr($parm,"="))
|
if(strstr($parm,"="))
|
||||||
{ // query style parms.
|
{ // query style parms.
|
||||||
@@ -120,15 +122,16 @@ if(varset($click_target))
|
|||||||
{
|
{
|
||||||
$pre = varset($click_prefix);
|
$pre = varset($click_prefix);
|
||||||
$post = varset($click_postfix);
|
$post = varset($click_postfix);
|
||||||
$text .= "<a href='#'{$hide} onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name_id}\").value+\"{$post}\", true);document.getElementById(\"{$name_id}\").selectedIndex = -1;return false;'>";
|
$text .= "<a href='#'{$hide} title='Select' onclick='addtext(\"{$pre}\"+document.getElementById(\"{$name_id}\").value+\"{$post}\", true);document.getElementById(\"{$name_id}\").selectedIndex = -1;return false;'>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$text .= "<a href='{$pvw_default}'{$hide} rel='external' class='e-image-preview'>";
|
$text .= "<a href='{$pvw_default}'{$hide} rel='external' title='Preview {$pvw_default}' class='e-image-preview'>";
|
||||||
}
|
}
|
||||||
if(vartrue($height)) $height = "height:{$height};";
|
if(vartrue($height)) $height = intval($height);
|
||||||
if(vartrue($width)) $width = "width:{$width}; ";
|
if(vartrue($width)) $width = intval($width);
|
||||||
$text .= "<img src='{$pvw_default}' alt='' style='{$width}{$height}' /></a>";
|
$thpath = isset($parms['nothumb']) ? $pvw_default : $tp->thumbUrl($pvw_default, 'w='.$width.'h='.$height, true);
|
||||||
|
$text .= "<img src='{$thpath}' alt='$pvw_default' class='image-selector' /></a>";
|
||||||
|
|
||||||
$text .= "</div>\n";
|
$text .= "</div>\n";
|
||||||
|
|
||||||
|
@@ -177,7 +177,7 @@ class e_form
|
|||||||
$parms .= "&multiple=FALSE";
|
$parms .= "&multiple=FALSE";
|
||||||
$parms .= "&label=-- ".$label." --";
|
$parms .= "&label=-- ".$label." --";
|
||||||
$parms .= "&subdirs=".varset($sc_parameters['subdirs'], 1);
|
$parms .= "&subdirs=".varset($sc_parameters['subdirs'], 1);
|
||||||
$parms .= '&width='.vartrue($sc_parameters['width'], 150).'px';
|
$parms .= '&width='.vartrue($sc_parameters['width'], 150);
|
||||||
if(vartrue($sc_parameters['height'])) $parms .= '&height='.$sc_parameters['height'].'px';
|
if(vartrue($sc_parameters['height'])) $parms .= '&height='.$sc_parameters['height'].'px';
|
||||||
//$parms .= "&tabindex=".$this->getNext();
|
//$parms .= "&tabindex=".$this->getNext();
|
||||||
//$parms .= "&click_target=data";
|
//$parms .= "&click_target=data";
|
||||||
|
Reference in New Issue
Block a user