Lynx
Пользователь
Была такая же ошибка, по этому я и снёс этот мод.http:// адрес сайта/no_poster
Такой директории нет, да и не должно быть.
Оригинальное решениеБыла такая же ошибка, по этому я и снёс этот мод.
Ну а ты как думал? креативно, чоОригинальное решение
if($bb_cfg['t_last_added_num'])
{
$data = DB()->fetch_rowset("SELECT
tr.topic_id, tr.forum_id, tr.reg_time, sn.seeders, sn.leechers, tr.tor_status,
t.topic_title, t.topic_image,
f.forum_name,
u.username, u.user_id, u.user_rank
FROM
". BB_BT_TORRENTS ." tr
LEFT JOIN ". BB_TOPICS ." t ON tr.topic_id = t.topic_id
LEFT JOIN ". BB_FORUMS ." f ON tr.forum_id = f.forum_id
LEFT JOIN ". BB_USERS ." u ON tr.poster_id = u.user_id
LEFT JOIN ". BB_BT_TRACKER_SNAP ." sn ON sn.topic_id = t.topic_id
ORDER BY
tr.reg_time DESC
LIMIT 0,".$bb_cfg['t_last_added_num']);
$this->store('last_added', $data);
}
if($bb_cfg['t_last_added_num'])
{
if (!$last_added = $datastore->get('last_added'))
{
$datastore->update('last_added');
$last_added = $datastore->get('last_added');
}
$template -> assign_vars(array(
'LAST_ADDED_ON' => true,
));
$last_added = $datastore->get('last_added');
foreach ($last_added as $last_add)
{
$title_post = $last_add['topic_title'];
$limit = '20'; // 10 знаков
if (strlen($title_post) > $limit)
{
$title_post = substr($title_post, 0, $limit);
$title_post .= '...';
}
$template -> assign_block_vars('lastAdded',array(
'TITLE' => $title_post,
'TOPIC_ID' => $last_add['topic_id'],
'FORUM' => $last_add['forum_name'],
'FORUM_ID' => $last_add['forum_id'],
'POSTER' => profile_url(array('username' => $last_add['username'], 'user_rank' => $last_add['user_rank'])),
'POSTER_ID' => $last_add['user_id'],
'TORRENT_TIME' => bb_date($last_add['reg_time'], 'false'),
'SEEDERS' => $last_add['seeders'],
'LEECHERS' => $last_add['leechers'],
'POSTER_IMG' => $last_add['topic_image'],
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$last_add['tor_status']],
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$last_add['tor_status']],
)) ;
}
}
<a href="viewtopic.php?t={lastAdded.TOPIC_ID}"><center><img width="75" src="{lastAdded.POSTER_IMG}"></center></a>
get_thumb($post_id, $topic_id);
function get_thumb($post_id, $topic_id)
{
$cMaxWidth = 90; //размер тумбы))
$tText = DB()->fetch_row("SELECT post_text FROM " . BB_POSTS_TEXT . " WHERE post_id = $post_id");
preg_match_all('/\[img=right\](.*?)\[\/img\]/i', $tText['post_text'], $tPaImg, PREG_SET_ORDER);
preg_match_all('/\[img=left\](.*?)\[\/img\]/i', $tText['post_text'], $tPaImg2, PREG_SET_ORDER);
preg_match_all('/\[img\](.*?)\[\/img\]/i', $tText['post_text'], $tPaImg3, PREG_SET_ORDER);
$url = '';
if (@$tPaImg[0][1])
{
$url = $tPaImg[0][1];
}
elseif (@$tPaImg2[0][1])
{
$url = $tPaImg2[0][1];
}
elseif (@$tPaImg3[0][1])
{
$url = $tPaImg3[0][1];
}
if(!empty($url))
{
$imgs = @file_get_contents($url, 0, stream_context_create( array('http' => array('timeout' => 60)) ));
if ($imgs != null)
{
mt_srand(time()+microtime()*rand(1,999));
$filename = 'pictures/'.md5('topic_'.$topic_id).'_original.png';
file_put_contents($filename,$imgs);
$iInfo = getimagesize($filename);
list($poster_width, $poster_height) = getimagesize($filename);
switch ($iInfo['mime'])
{
case 'image/png':
$cImage = imagecreatefrompng($filename);
break;
case 'image/gif':
$cImage = imagecreatefromgif($filename);
break;
case 'image/jpeg':
$cImage = imagecreatefromjpeg($filename);
break;
default:
$cImage = false;
}
if($cImage)
{
$thumb_width = $cMaxWidth;
$thumb_height = ($poster_height*$cMaxWidth)/$poster_width;
$tImage = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($tImage, $cImage, 0, 0, 0, 0, $thumb_width, $thumb_height, $poster_width, $poster_height);
imagealphablending($tImage, false);
imagesavealpha($tImage, true);
imagejpeg($tImage, 'pictures/'.md5('topic_'.$topic_id).'.jpg', 100);
imagedestroy($tImage);
imagedestroy($cImage);
DB()->query("UPDATE " . BB_TOPICS . " SET topic_image = 'pictures/" . (md5('topic_'.$topic_id)) . ".jpg' WHERE topic_id=$topic_id");
}
}
}
}