Customizing SMF > Modifications and Packages

Random Image Attachment Banner

<< < (2/11) > >>

ProfDrDenis:

--- Quote from: madman71 on May 23, 2010, 06:15:34 PM ---what do you mean "todo"?

--- End quote ---


on which place I put what so that the pics are - for example - have a width from 300x

madman71:
You want to have the thumbnails displayed at 300px wide in the banner??
or do you want the entire banner displayed at 300px wide?

ProfDrDenis:

--- Quote from: madman71 on May 24, 2010, 12:55:52 PM ---You want to have the thumbnails displayed at 300px wide in the banner??
or do you want the entire banner displayed at 300px wide?

--- End quote ---

not the banner, the pics! With the pics like 1024x the style is not nice

madman71:
I looked at the code in the BOARDATTACHMENTS.PHP and could not find any place where you can change the dimensions of the displayed thumbnails.

I'll post the code here.  Maybe someone with an eye for code and spot it for you:


I was looking at this part, but i think it has to do with the actual file size and not dimensions.

--- Code: ---'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'],
--- End code ---

BOARDATTACHMENTS.PHP


--- Code: ---function get_recent_attachments()
{
global $smcFunc, $context, $modSettings, $scripturl, $txt, $settings;

$num_attachments = 6;
$attachment_ext = array('jpg', 'jpeg', 'png', 'gif', 'bmp');

$attachments_boards = boardsAllowedTo('view_attachments');

if (empty($attachments_boards))
return;

if (!is_array($attachment_ext))
$attachment_ext = array($attachment_ext);

$request = $smcFunc['db_query']('', '
SELECT
att.id_attach, att.id_msg, att.filename, IFNULL(att.size, 0) AS filesize, att.downloads, mem.id_member,
IFNULL(mem.real_name, m.poster_name) AS poster_name, m.id_topic, m.subject, t.id_board, m.poster_time,
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)') . '
WHERE att.attachment_type = 0' . ($attachments_boards === array(0) ? '' : '
AND m.id_board IN ({array_int:boards_can_see})') . (!empty($attachment_ext) ? '
AND att.fileext IN ({array_string:attachment_ext})' : '') .
(!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}
AND att.approved = {int:is_approved}') . '
ORDER BY RAND()
LIMIT {int:num_attachments}',
array(
'boards_can_see' => $attachments_boards,
'attachment_ext' => $attachment_ext,
'num_attachments' => $num_attachments,
'is_approved' => 1,
)
);

$context['recent_attachments'] = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$filename = preg_replace('~&amp;#(\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\1;', htmlspecialchars($row['filename']));

$context['recent_attachments'][$row['id_attach']] = array(
'member' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>',
),
'file' => array(
'filename' => $filename,
'filesize' => round($row['filesize'] /1024, 2) . $txt['kilobyte'],
'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['poster_time']),
),
);

if ($context['recent_attachments'][$row['id_attach']]['file']['is_image'])
{
$id_thumb = empty($row['id_thumb']) ? $row['id_attach'] : $row['id_thumb'];
$context['recent_attachments'][$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 . '" /></a>',
);
}
}
$smcFunc['db_free_result']($request);

if (!empty($context['recent_attachments']))
{
loadTemplate('BoardAttachments', 'board_attach');
$context['template_layers'][] = 'board_attach';
--- End code ---

ProfDrDenis:
nobody can help?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version