1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Downloads: Legacy Upgrade image-path fixes.

This commit is contained in:
Cameron
2016-12-03 14:16:14 -08:00
parent 6eefc91a9b
commit 03a6a63694
2 changed files with 53 additions and 16 deletions

View File

@@ -3739,6 +3739,7 @@ class e_parser
* Render an <img> tag. * Render an <img> tag.
* @param string $file * @param string $file
* @param array $parm legacy|w|h|alt|class|id|crop * @param array $parm legacy|w|h|alt|class|id|crop
* @param array $parm['legacy'] Usually a legacy path like {e_FILE}
* @return string * @return string
* @example $tp->toImage('welcome.png', array('legacy'=>{e_IMAGE}newspost_images/','w'=>200)); * @example $tp->toImage('welcome.png', array('legacy'=>{e_IMAGE}newspost_images/','w'=>200));
*/ */
@@ -3806,6 +3807,7 @@ class e_parser
{ {
$log = e107::getAdminLog(); $log = e107::getAdminLog();
$log->addDebug('Broken Image Path: '.$legacyPath."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00'); $log->addDebug('Broken Image Path: '.$legacyPath."\n".print_r(debug_backtrace(null,2), true), false)->save('IMALAN_00');
e107::getDebug()->log("Broken Image Path: ".$legacyPath);
} }
} }

View File

@@ -321,7 +321,19 @@ class download_shortcodes extends e_shortcode
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$img = ($this->var['download_thumb']) ? "<img class='download-thumb img-responsive' src='".$tp->thumbUrl($this->var['download_thumb'])."' alt=\"".$this->var['download_name']."\" />" : ""; $img = "";
if(!empty($this->var['download_thumb']))
{
$opts = array(
'legacy' => "{e_FILE}downloadthumbs/",
'class' => 'download-image img-responsive',
'alt' => $this->var['download_name']
);
$img = $tp->toImage($this->var['download_thumb'], $opts);
}
if ($parm == "link" && $this->var['download_thumb']) if ($parm == "link" && $this->var['download_thumb'])
{ {
@@ -392,7 +404,12 @@ class download_shortcodes extends e_shortcode
function sc_download_list_imagefull($parm='') function sc_download_list_imagefull($parm='')
{ {
$img = ($this->var['download_image']) ? "<img class='download-image dl_image img-responsive' src='".e107::getParser()->thumbUrl($this->var['download_image'])."' alt=\"".$this->var['download_name']."\" />" : ""; $img = "";
if(!empty($this->var['download_image']))
{
$img = $this->sc_download_view_imagefull();
}
if($parm == "link" && $this->var['download_image']) if($parm == "link" && $this->var['download_image'])
{ {
@@ -561,13 +578,20 @@ class download_shortcodes extends e_shortcode
{ {
$tp = e107::getParser(); $tp = e107::getParser();
if ($this->var['download_thumb'])
if($this->var['download_thumb'])
{ {
return ($this->var['download_image'] ? "<a href='".e_PLUGIN_ABS."download/request.php?download.".$this->var['download_id']."'><img class='download-image dl_image img-responsive' src='".$tp->thumbUrl($this->var['download_thumb'])."' alt='*' /></a>" : "<img class='download-image dl_image img-responsive' src='".$tp->thumbUrl($this->var['download_thumb'])."' alt='*' />"); $opts = array(
'legacy' => "{e_FILE}downloadthumbs/",
'class' => 'download-image dl_image img-responsive'
);
$image = $tp->toImage($this->var['download_thumb'], $opts);
return ($this->var['download_image'] ? "<a href='" . e_PLUGIN_ABS . "download/request.php?download." . $this->var['download_id'] . "'>" . $image . "</a>" : $image);
} }
elseif ($this->var['download_image']) elseif($this->var['download_image'])
{ {
return "<a href='".e_PLUGIN_ABS."download/request.php?download.".$this->var['download_id']."'>".LAN_dl_40."</a>"; return "<a href='" . e_PLUGIN_ABS . "download/request.php?download." . $this->var['download_id'] . "'>" . LAN_dl_40 . "</a>";
} }
else else
{ {
@@ -578,10 +602,21 @@ class download_shortcodes extends e_shortcode
/** /**
* {DOWNLOAD_VIEW_LINK: class=thumbnail} * {DOWNLOAD_VIEW_LINK: class=thumbnail}
*/ */
function sc_download_view_imagefull($parm) function sc_download_view_imagefull($parm=array())
{ {
$tp = e107::getParser();
return ($this->var['download_image']) ? "<img class='download-image dl_image download-view-image img-responsive ".vartrue($parm['class'])."' src='".$tp->thumbUrl($this->var['download_image'])."' alt='*' />" : ""; if(!empty($this->var['download_image']))
{
$opts = array(
'legacy' => "{e_FILE}downloadimages/",
'class' => 'download-image dl_image download-view-image img-responsive '.vartrue($parm['class']),
'alt' => basename($this->var['download_image'])
);
return e107::getParser()->toImage($this->var['download_image'], $opts);
}
} }
/** /**