News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Auto-Thumbnail Enlarging...?

Started by wildcard, June 29, 2005, 06:03:30 AM

Previous topic - Next topic

wildcard

Ok, the feature where you attach a message to a forum post and it gets displayed as a thumbnail, and ya can click on it to enlarge it.  That's in 1.1b3 right?  If so, I can't seem to get it to work on my forum.

FYI, tho, flawlessly updated for me.  Excellent work!

Update: DOH!  Serves me right for not checkin the board first.  Seems it's theme related, it does display correctly for me with the default themes.

Another Update: Copies the following code from display.template.php from the Default template

// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<hr width="100%" size="1" class="hrcolor" />
<div style="overflow: auto; width: 100%;">';
foreach ($message['attachment'] as $attachment)
{
if ($attachment['is_image'])
{
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 />';
}
echo '
<a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" />&nbsp;' . $attachment['name'] . '</a> (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
}

echo '
</div>';
}

echo '
</td>
</tr><tr>
<td valign="bottom" class="smalltext">';
and pasted it into the display.template.php for the theme and it works fine.

However, is there a way or an inmessage variable I can use to have it display the thumbnailed attachment as PART of the message?  Just curious.

Ben_S

Quote from: wildcard on June 29, 2005, 06:03:30 AM
However, is there a way or an inmessage variable I can use to have it display the thumbnailed attachment as PART of the message?  Just curious.

There isn't.
Liverpool FC Forum with 14 million+ posts.

wildcard

Damn, there really should be.  Something like...

[img thumbwidth=150]image here[/url]

That'd rock!

wildcard

OK, well, it WAS working right.  Now, whenever I click on a thumbnail, it opens the full image in a new window instead of just enlarging it in the current window...

wildcard

Well, it appears there's some javascript in default/display.template.php that needs to be ported over to your theme/display.template.php.  Add the following from the former to the latter, at the end of the javascript section:

function expandThumb(thumbID)
{
var img = document.getElementById("thumb_" + thumbID);
var link = document.getElementById("link_" + thumbID);
var tmp = img.src;
img.src = link.href;
link.href = tmp;
img.style.width = "";
img.style.height = "";
return false;
}

biggbigg

Thanks dude worked great and fixed my blackday theme with that.  GJ Guys.

Gargoyle

#6
So now what does one do when ones theme has the above code in it and it still does not work properly ?

Currently this is my issue... It is out there....

* burnout.JPG (71.83 KB, 536x741 - viewed 1 times.) - Displays correctly
* ricers1.gif (37.01 KB, 600x600 - viewed 0 times.) - Displays correctly

* SimpsonsRicer_krusty2001.jpg (20.25 KB, 396x512 - viewed 0 times.) - Link only - Incorrect display
* ricecititation.jpg (41.6 KB, 400x800 - viewed 0 times.) - Link only - Incorrect display

It makes no sense to me at all .....  >:(

ArkServer

Doesnt work here, tried to copy paste yoru code and other things but it doesnt work for me.
Could it be that the theme is ******ing  :-\

example:
http://arkserver.servehttp.com/forum/index.php?topic=600.0

[Unknown]

As stated, some attachment thumbnails wouldn't display properly in 1.1 Beta 3 Public.  This problem has been solved in 1.1 Beta 4, and will be solved in the next release.

-[Unknown]

jbryant

This fix has saved my life.
Thank you.

The reason it may not work for some is that the code posted includes the end of a table that should not be there.
Only copy code to the end of Echo.
Check out our live cam community....WaynesvilleLive.com

Advertisement: