Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: Scferg - helmikuu 10, 2008, 02:53:48 AP

Otsikko: Load image in new window
Kirjoitti: Scferg - helmikuu 10, 2008, 02:53:48 AP
In the topic view (where you see the posts), is it possible to load the image in a new window/ tab?

For example:


Attachments:
(#post_)
screenshot.jpg (#post_)

And the image link will open the full size view in a new window, instead of that div.
Otsikko: Re: Load image in new window
Kirjoitti: !Hachi! - helmikuu 10, 2008, 07:57:17 AP
its attachment or simple image link? like YOURWEB.com/IMG/SCN.jpg?
               
Otsikko: Re: Load image in new window
Kirjoitti: Scferg - helmikuu 10, 2008, 01:16:10 IP
The attachment was uploaded into the post, so the path is quite lengthy ( http://mysite.com/forum/index.php?action=dlattach;topic=330.0;attach=36;image )
Otsikko: Re: Load image in new window
Kirjoitti: Remaker - helmikuu 11, 2008, 10:44:35 AP
You can do that but you would have to edit your forum's theme ;)
Otsikko: Re: Load image in new window
Kirjoitti: Scferg - helmikuu 11, 2008, 03:17:45 IP
Fine with me...I just don't know what to change.
Otsikko: Re: Load image in new window
Kirjoitti: Remaker - helmikuu 11, 2008, 03:27:37 IP
Edit display.template.php from your theme folder.


Search for:

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 />';


replace with:

echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" target="_BLANK"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';


This should work even though I haven't tested the code ;)
Otsikko: Re: Load image in new window
Kirjoitti: Scferg - helmikuu 11, 2008, 03:33:57 IP
Perfect!

Thanks ;)