How to show thumbnails?

Started by P, November 02, 2006, 03:16:46 PM

Previous topic - Next topic

P

SMF Version: SMF 1.1 RC3
Hello, i need a package that when an user of my forum attaches some images to his post, there are the thumbnails of the images.


How can i do?


Thanks

Oldiesmann

Admin -> Attachments and Avatars
Check the box next to "Resize images when showing under posts"
Michael Eshom
Christian Metal Fans

P

many thanks, can i see them inline?

It places only 1 thumb every line, can i put like 5 or 6?

Oldiesmann

Try this... I can't guarantee that it will look good, but it should do what you want.

Themes/default/Display.template.php

Find
if (!empty($message['attachment']))
{


Add after that
$counter = 0;

Find
if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
else
echo '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';


Replace
if($counter > 5)
{
$counter = 1;
$char = '<br />';
}
else
{
$counter ++;
$char = '&nbsp;';
}

if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a>' . $char;
else
echo '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" />' . $char;


That will display 5 thumbnails in a row (with a space after each one) before going to a new line.
Michael Eshom
Christian Metal Fans

Advertisement: