Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (stripos ( $tpl->copy_template, "{fullimage-" ) !== false || stripos ( $tpl->copy_template, "{imagelarge-" ) !== false ) {
- $images = array();
- preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['xfields'], $media);
- $data=preg_replace('/(img|src)("|\'|="|=\')(.*)/i',"$3",$media[0]);
- foreach($data as $url) {
- $info = pathinfo($url);
- if (isset($info['extension'])) {
- if ($info['filename'] == "spoiler-plus" OR $info['filename'] == "spoiler-plus" ) continue;
- $info['extension'] = strtolower($info['extension']);
- if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url);
- }
- }
- if ( count($images) ) {
- $i=0;
- foreach($images as $url) {
- $i++;
- $tpl->copy_template = str_replace( '{fullimage-'.$i.'}', $url, $tpl->copy_template );
- $tpl->copy_template = str_replace( '[fullimage-'.$i.']', "", $tpl->copy_template );
- $tpl->copy_template = str_replace( '[/fullimage-'.$i.']', "", $tpl->copy_template );
- //Проверяем на нашем ли хостинге находится картинка
- $checkMyServer = parse_url($url);
- if(stripos($config['http_home_url'], $checkMyServer['host'] ) !== false && stripos($checkMyServer['path'],'/thumbs/') !== false){
- $tpl->copy_template = str_replace( '{imagelarge-'.$i.'}', str_replace('thumbs/','',$url), $tpl->copy_template );
- }else{$tpl->copy_template = str_replace( '{imagelarge-'.$i.'}',$url, $tpl->copy_template );}
- $tpl->copy_template = str_replace( '[imagelarge-'.$i.']', "", $tpl->copy_template );
- $tpl->copy_template = str_replace( '[/imagelarge-'.$i.']', "", $tpl->copy_template );
- }
- }
- $tpl->copy_template = preg_replace( "#\[fullimage-(.+?)\](.+?)\[/fullimage-(.+?)\]#is", "", $tpl->copy_template );
- $tpl->copy_template = preg_replace( "#\\{fullimage-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template );
- $tpl->copy_template = preg_replace( "#\[imagelarge-(.+?)\](.+?)\[/imagelarge-(.+?)\]#is", "", $tpl->copy_template );
- $tpl->copy_template = preg_replace( "#\\{imagelarge-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template );
- }
Advertisement
Add Comment
Please, Sign In to add comment