SimplePortal

Support => International Support => German => Topic started by: Acer1 on June 21, 2009, 08:15:55 AM

Title: Block
Post by: Acer1 on June 21, 2009, 08:15:55 AM
Hi.. bei dem Block "Neuste angehängte Bilder-Block" wie bekomme ich denn da etwas weg... und zwar soll da kein Bilduntertitel stehen und auch kein Autor sondern rein nur die Bilder !

Mfg.Acer1

SimplePortal2.2.2 + SMF1.9
Title: Re: Block
Post by: ???1031 on June 23, 2009, 12:52:39 AM
An und für sich finde ich das ein gute idee es um die wenigen optionen zu erweitern :). (Kein Titel, Keine Dateigröße usw.). Ich werde es für die nächste Version berücksichtigen.

Hmmm ich gebe dir mal ein PHP Block dafür:
SMF 1.1.x
Code: [Select]
// Change you paramenters
// How many imopages?
$parameters['limit'] = 5;
// Direction 0 = Vertical, 1 = Non-Vertical
$parameters['direction'] = 0;
if(!function_exists('sp_attachmentImageOnly'))
{
function sp_attachmentImageOnly($parameters, $id, $return_parameters = false)
{
global $db_prefix, $modSettings, $scripturl, $txt, $settings, $user_info;

$block_parameters = array(
'limit' => 'int',
'direction' => 'select',
);

if ($return_parameters)
return $block_parameters;

$limit = empty($parameters['limit']) ? 5 : (int) $parameters['limit'];
$direction = empty($parameters['direction']) ? 0 : 1;
$type = array('jpg', 'png', 'gif', 'bmp');
$boards = boardsAllowedTo('view_attachments');

if (empty($boards))
{
echo '
', $txt['error_sp_no_attachments_found'];
return;
}
elseif ($boards[0] == 0)
$boards = '';
else
$boards = ' AND m.ID_BOARD IN (' . implode(',', $boards) . ')';

$request = db_query("
SELECT
att.ID_ATTACH, att.ID_MSG, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.ID_MEMBER,
IFNULL(mem.realName, m.posterName) AS posterName, m.ID_TOPIC, m.subject, t.ID_BOARD, m.posterTime,
att.width, att.height" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? "" : ", IFNULL(thumb.ID_ATTACH, 0) AS id_thumb, thumb.width AS thumb_width, thumb.height AS thumb_height") . "
FROM {$db_prefix}attachments AS att
INNER JOIN {$db_prefix}messages AS m ON (m.ID_MSG = att.ID_MSG)
INNER JOIN {$db_prefix}topics AS t ON (t.ID_TOPIC = m.ID_TOPIC)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (empty($modSettings['attachmentShowImages']) || empty($modSettings['attachmentThumbnails']) ? "" : "
LEFT JOIN {$db_prefix}attachments AS thumb ON (thumb.ID_ATTACH = att.ID_THUMB)") . "
LEFT JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE att.attachmentType = 0
AND att.width != 0
AND $user_info[query_see_board]
$boards
ORDER BY att.ID_ATTACH DESC
LIMIT $limit", __FILE__, __LINE__);
$items = array();
while ($row = mysql_fetch_assoc($request))
{
$filename = preg_replace('~&#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', htmlspecialchars($row['filename']));

$items[$row['ID_ATTACH']] = array(
'member' => array(
'id' => $row['ID_MEMBER'],
'name' => $row['posterName'],
'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>',
),
'file' => array(
'filename' => $filename,
'filesize' => round($row['filesize'] /1024, 2) . $txt['smf211'],
'downloads' => $row['downloads'],
'href' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'],
'link' => '<img src="' . $settings['images_url'] . '/icons/clip.gif" alt="" /> <a href="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'] . '">' . $filename . '</a>',
'is_image' => !empty($row['width']) && !empty($row['height']) && !empty($modSettings['attachmentShowImages']),
),
'topic' => array(
'id' => $row['ID_TOPIC'],
'subject' => $row['subject'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
'time' => timeformat($row['posterTime']),
),
);

if ($items[$row['ID_ATTACH']]['file']['is_image'])
{
$id_thumb = empty($row['ID_THUMB']) ? $row['ID_ATTACH'] : $row['ID_THUMB'];
$items[$row['ID_ATTACH']]['file']['image'] = array(
'id' => $id_thumb,
'width' => $row['width'],
'height' => $row['height'],
'img' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'] . ';image" alt="' . $filename . '" />',
'thumb' => '<img src="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '" />',
'href' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $id_thumb . ';image',
'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['ID_ATTACH'] . ';image"><img src="' . $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $id_thumb . ';image" alt="' . $filename . '"' . (empty($row['ID_THUMB']) ? ' width="100"' : '') . ' /></a>',
);
}
}
mysql_free_result($request);

if (empty($items))
{
echo '
', $txt['error_sp_no_attachments_found'];
return;
}

$colorids = array();
foreach ($items as $item)
$colorids[] = $item['member']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($items as $k => $p)
{
if (!empty($color_profile[$p['member']['id']]['link']))
$items[$k]['member']['link'] = $color_profile[$p['member']['id']]['link'];
}
}

echo '
<table class="sp_auto_align">', $direction ? '
<tr>' : '';

foreach ($items as $item)
{
  echo !$direction ? '
<tr>' : '', '
<td>', $item['file']['image']['link'], '
</td>', !$direction ? '
</tr>' : '';
}

echo $direction ? '
</tr>' : '', '
</table>';
}
}
sp_attachmentImageOnly($parameters, $id);

Gruß
DIN1031
Title: Re: Block
Post by: Acer1 on June 23, 2009, 12:58:20 PM
Hmm ich glaube du hast mich falsch verstanden ! Ich möchte das nur die Bilder angezeigt werden ! Sonst nichts !  :D
Title: Re: Block
Post by: ???1031 on June 25, 2009, 03:23:49 PM
Ja das sollte der block machen oder oO.
Ups ;)
Upgedated hab ausversehen die falsche zeile übrig gelassen xD.
Title: Re: Block
Post by: Acer1 on June 26, 2009, 05:45:06 PM
Danke dir !!!!!!!!!! Klasse !!!!!!!!  8) 8) :thumbsup:
Title: Re: Block
Post by: Acer1 on January 23, 2010, 11:12:40 AM
Hmmm hat jemand den Block für RC2 ???
Title: Re: Block
Post by: Acer1 on January 30, 2010, 11:09:46 AM
Hmmm keiner ???
SimplePortal 2.3.8 © 2008-2024, SimplePortal