Lokesh Dhakar. This plugin is based on "Lightbox 2" plugin for WordPress. Example: http://www.sablinov.ru/forums/topic/1 Version: 0.25 Author: A1ex Author URI: http://bbpress.ru */ /* Select your theme: */ $lightbox_2_theme = "Black"; //$lightbox_2_theme = "Dark Grey"; //$lightbox_2_theme = "Grey"; //$lightbox_2_theme = "White"; $tumb_width = 100; $tumb_height = 100; $tumbs_path = ""; $tumbs_url = ""; // STOP EDITING!!! function bb_preg_callback2($matches) { return ''.''; } function bb_removeLinks($content) { $content = preg_replace_callback('@("]*/)(.*?[^"]))"[^<]*?>)(?!<\/a>)@i', "bb_preg_callback2", $content); $content = preg_replace_callback('@(\']*/)(.*?[^\']))\'[^<]*?>)(?!<\/a>)@i', "bb_preg_callback2", $content); return $content; } function lightbox_styles() { /* The next lines figures out where the javascripts and images and CSS are installed, relative to your bbpress server's root: */ global $lightbox_2_theme; $lightbox_2_theme_path = (dirname(__FILE__)."/Themes"); $lightbox_style = (bb_get_option('uri')."my-plugins/bb-lightbox2/Themes/".$lightbox_2_theme."/"); $lightbox_path = bb_get_option('uri')."my-plugins/bb-lightbox2/bb-lightbox2/"; /* The xhtml header code needed for lightbox to work: */ $lightboxscript = " \n"; /* Output $lightboxscript as text for our web pages: */ echo($lightboxscript); } function GetImgType($image) { $info = getimagesize($image); switch($info[2]) { case 1: return "gif"; break; case 2: return "jpg"; break; case 3: return "png"; break; default: return false; } } function ImgTumb($image_path, $image_file) { global $tumb_width, $tumb_height, $tumbs_path, $tumbs_url; if(!$tumbs_path) { $tumbs_path = BBPATH.'tumbs/'; } if(!$tumbs_url) { $tumbs_url = bb_get_option('uri').'tumbs/'; } $tumb_name = 'tumb_'.md5($image_path).'_'.$image_file; $tumb_path = $tumbs_path.$tumb_name; $tumb_url = $tumbs_url.$tumb_name; if(!is_file($tumb_path)) { $image = $image_path; $this_type = GetImgType($image); // Get new dimensions list($image_width, $image_height) = getimagesize($image); if ($image_width<=$tumb_width && $image_height<=$tumb_height) { copy ($image, $tumb_path); } else { $ratio = $image_width/$image_height; if ($tumb_width/$tumb_height > $ratio) { $tumb_width = $tumb_height*$ratio; } else { $tumb_height = $tumb_width/$ratio; } $tumb_image = imagecreatetruecolor($tumb_width, $tumb_height); switch($this_type) { case "gif": $image = imagecreatefromgif($image); imagecopyresampled($tumb_image, $image, 0, 0, 0, 0, $tumb_width, $tumb_height, $image_width, $image_height); imagegif($tumb_image, $tumb_path); break; case "jpg": $image = imagecreatefromjpeg($image); imagecopyresampled($tumb_image, $image, 0, 0, 0, 0, $tumb_width, $tumb_height, $image_width, $image_height); imagejpeg($tumb_image, $tumb_path); break; case "png": $image = imagecreatefrompng($image); imagecopyresampled($tumb_image, $image, 0, 0, 0, 0, $tumb_width, $tumb_height, $image_width, $image_height); imagepng($tumb_image, $tumb_path); break; } } } return $tumb_url; } add_action('post_text', 'bb_removeLinks'); /* we want to add the above xhtml to the header of our pages: */ add_action('bb_head', 'lightbox_styles'); ?>