diff --git a/e107_core/bbcodes/bb_img.php b/e107_core/bbcodes/bb_img.php index e417a187d..d567cd75f 100644 --- a/e107_core/bbcodes/bb_img.php +++ b/e107_core/bbcodes/bb_img.php @@ -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}'); diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index 906eec5df..2295a5c51 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -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]) {