Не нравятся результаты поиска? Попробуйте другой поиск!
DLE FAQ » Все вопросы » Общие вопросы » Как сделать thumb full-image в short_story ?

Как сделать thumb full-image в short_story ?


     01.05.2017    Общие вопросы, Общие вопросы по PHP    1166

вопрос
Привет, возник вопрос как вывести THUMB изображение в short_story?
Изображение находится в full_story.
Когда изображение вставляю в short-story - картинка выводитя thumb. если изменить "short_story" под full_story - картинки нету! Подскажите.
			// Доработка
			if (stripos ( $tpl->copy_template, "{thumb-" ) !== false) {

				$images = array();
				preg_match_all('/(img|src)=("|\')[^"\'>]+/i', $row['short_story'], $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-minus" ) 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_count=0;
					foreach($images as $url) {
						$i_count++;
						$url2 = explode("/", $url);
						if(in_array('medium', $url2)) {
						$url2[count($url2)-2] = "thumbs";
						$url = implode("/", $url2);
						} else
						if(!in_array('thumbs', $url2)) {
						$url2[count($url2)-1] = "thumbs/" . $url2[count($url2)-1];
						$url = implode("/", $url2);
						}
						$tpl->copy_template = str_replace( '{thumb-'.$i_count.'}', $url, $tpl->copy_template );
						$tpl->copy_template = str_replace( '[thumb-'.$i_count.']', "", $tpl->copy_template );
						$tpl->copy_template = str_replace( '[/thumb-'.$i_count.']', "", $tpl->copy_template );
					}
	
				}
	
				$tpl->copy_template = preg_replace( "#\[thumb-(.+?)\](.+?)\[/thumb-(.+?)\]#is", "", $tpl->copy_template );
				$tpl->copy_template = preg_replace( "#\\{thumb-(.+?)\\}#i", "{THEME}/dleimages/no_image.jpg", $tpl->copy_template );
	
			}
			// Доработка

Ответа пока нет


Чтобы комментировать - войдите или зарегистрируйтесь на сайте

Похожие вопросы

 06.03.2014 vip.boss  Общие вопросы
наверх