mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
BC Fix for {NEWSTHUMBNAIL}
This commit is contained in:
@@ -124,7 +124,7 @@ class bb_img extends e_bb_base
|
||||
return $this->mediaImage($code_text, $parm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (preg_match("#\.php\?.*#",$code_text)){return "";} //XXX Breaks MediaManager Images, so do it after mediaManager check.
|
||||
@@ -137,10 +137,11 @@ class bb_img extends e_bb_base
|
||||
$h = e107::getBB()->resizeHeight();
|
||||
|
||||
// No resizing on v1.x legacy images.
|
||||
if(strpos($code_text,"://")==false && ($w || $h) && strpos($code_text,"{e_IMAGE}custom")===false && strpos($code_text,"{e_IMAGE}newpost_images")===false) // local file.
|
||||
if(strpos($code_text,"://")==false && ($w || $h) && strpos($code_text,"{e_IMAGE}custom")===false && strpos($code_text,"newspost_images/")===false) // local file.
|
||||
{
|
||||
$code_text = $tp->thumbUrl($code_text,'w='.$w.'&h='.$h);
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
|
||||
$search = array('"', '{E_IMAGE}', '{E_FILE}', '{e_IMAGE}', '{e_FILE}');
|
||||
|
@@ -366,12 +366,23 @@ class news_shortcodes extends e_shortcode
|
||||
*/
|
||||
function sc_newsthumbnail($parm = '') //TODO Add support {NEWSTHUMBNAIL: x=y} format
|
||||
{
|
||||
if(!$this->news_item['news_thumbnail'] && $parm != 'placeholder')
|
||||
$newsThumb = $this->news_item['news_thumbnail'];
|
||||
|
||||
if(!$newsThumb && $parm != 'placeholder')
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if($vThumb = e107::getParser()->toVideo($this->news_item['news_thumbnail'], array('thumb'=>'src')))
|
||||
|
||||
if(empty($parm)) // get {SETIMAGE} values when no parm provided.
|
||||
{
|
||||
|
||||
$parm = '|aw='.e107::getParser()->thumbWidth().'&ah='.e107::getParser()->thumbHeight();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($vThumb = e107::getParser()->toVideo($newsThumb, array('thumb'=>'src')))
|
||||
{
|
||||
$src = $vThumb;
|
||||
$_src = '#';
|
||||
@@ -380,12 +391,32 @@ class news_shortcodes extends e_shortcode
|
||||
{
|
||||
$parms = eHelper::scDualParams($parm);
|
||||
|
||||
if(vartrue($parms[2]['legacy'])); // Legacy mode - swap out thumbnails for actual images and update paths.
|
||||
{
|
||||
if($newsThumb[0] != '{') // Fix old paths.
|
||||
{
|
||||
$newsThumb = '{e_IMAGE}newspost_images/'.$newsThumb;
|
||||
}
|
||||
|
||||
$tmp = str_replace('newspost_images/thumb_', 'newspost_images/', $newsThumb); // swap out thumb for image.
|
||||
|
||||
if(is_readable(e_IMAGE.$tmp))
|
||||
{
|
||||
$newsThumb = $tmp;
|
||||
}
|
||||
|
||||
unset($parms[2]);
|
||||
}
|
||||
|
||||
// We store SC path in DB now + BC
|
||||
$_src = $src = ($this->news_item['news_thumbnail'][0] == '{' || $parms[1] == 'placeholder') ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
|
||||
$_src = $src = ($newsThumb[0] == '{' || $parms[1] == 'placeholder') ? e107::getParser()->replaceConstants($newsThumb, 'abs') : e_IMAGE_ABS."newspost_images/".$newsThumb;
|
||||
|
||||
|
||||
if($parms[2] || $parms[1] == 'placeholder') $src = e107::getParser()->thumbUrl($src, $parms[2]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
switch($parms[1])
|
||||
{
|
||||
|
Reference in New Issue
Block a user