Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1067)
IMAGE THUMBNAIL v1.0
By Tomahawk
IntroductionEnables you use bbcode to post large images which will be preview with a link to full image using imgt bbcode
InstallationInstalls automatically on Default theme and any theme without a custom Post.template.php
To manually install this modification on other themes;
- place the imgt.gif in the "Themes/{ThemeName}/images/bbc" for EVERY THEME.
- A single manual edit is required FOR EACH THEME with a custom Post.template.php
Open Themes/{themename}/Post.template.php, and FIND:
$context['bbc_tags'][] = array(
'flash' => array('code' => 'flash', 'before' => '[flash=200,200]', 'after' => '[/flash]', 'description' => $txt[433]),
ADD AFTER:
'imgt' => array('code' => 'imgt', 'before' => '[imgt]', 'after' => '[/imgt]'),
If you are still having trouble, I recommend the Modification Parser (http://modparser.dev.dansoftaustralia.net/) by Daniel 15
How Do I Use This Mod?This bbcode tag is used like img tag, only this tag will not show full image, but only a preview.
[imgt]url_to_image[/imgt]
SupportPlease use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)
Changelog1.0o Initial release
great work !
is it possible to make an Pop Up box for adding the Url ? like the "image Pop Up" mod ?
greets
secy
I will try to add it to next version of mod, but I'm a bit busy right now...
is there a screenshot or demo of this mod ?
will this add the bbcode button automatically or do you have to manually input [imgt][/imgt]
theres a bbcode button (the big "T") and it adds the tag to your editor field....
It adds button on default theme, but you have to add it manually to other themes, check the readme file...
The resized image looks very weird...Its not properly scaled...
It depends on source image...
Quote from: ***Teh GodFather*** on February 07, 2008, 09:24:21 AM
It depends on source image...
The source image is a perfect high quality image.
http://www.cricinfo.com/db/PICTURES/CMS/86300/86338.jpg
I think it resizes the image to a perfect square...Please make it do like 30% of the original image or sth. :D
It resizes it to 100x90 px... I will try to add it to the next version, but I'm not so good with php...
Quote from: ***Teh GodFather*** on February 08, 2008, 02:15:25 PM
It resizes it to 100x90 px... I will try to add it to the next version, but I'm not so good with php...
Oh ok! If you could take out the next version fast, that would be very appreciated. Take the help of the tech guys on this forum for the next version ;) :D
Ok, I edited your mod to resize the height and width to 25%.
But I would like to wrap text around those images [I already have float mod] but I don't know how make it work?
Any help Tom or others?
Edit Got it! End result - http://eCric.net/smftest under "Recent Article"
Tom, If you would like me to share the edited mod package with you, please tell me. I'll give it you. :D
Btw, does anyone know how to use GD technology with this mod so that resized images are of good quality.
Thanks
Btw, does anyone know how to use GD technology with this mod so that resized images are of good quality.
Any PHP pros know how to do this?
Hello,
I just want to say that I absolutely love this mod along with karl's lightbox mod.
I was wandering if there is a way to automatically turn [img] tags into this tag, [imgt]. I've went and disabled the [img] tag completely and if someone was to manually post an [img] tag, is there a way to automatically turn it into your [imgt] tag? Thanks.
Well, you could just edit it directly in file Subs.php, find where [img] tag is and replace it with [imgt] and then just remove "t"...
I tried that but all current [img] tags now look like ( ) with the image link inside. :-\
It is very simple... Justi find this in Subs.php
Find
array(
'tag' => 'img',
'type' => 'unparsed_content',
'parameters' => array(
'alt' => array('optional' => true),
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
),
'content' => '<img src="$1" alt="{alt}"{width}{height} border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => '<img src="$1" alt="" border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),
And replace
'width' => array('optional' => true, 'value' => ' width="$1"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
with
'width' => array('optional' => true, 'value' => ' width="{your width}"', 'match' => '(\d+)'),
'height' => array('optional' => true, 'value' => ' height="{your height}"', 'match' => '(\d+)'),
is this modification to make thumbnail bigger ? it's to small ?? if not how could I do that ?
Thanks Teh Godfather, that worked perfectly.
Quote from: PanesarV on February 09, 2008, 07:03:43 PM
Edit Got it! End result - http://eCric.net/smftest under "Recent Article"
Bro, I am trying to figure this out too. Would you be able to help me out on the resize keeping the aspect ratio. Thanks.
Quote from: lvzifer on March 22, 2008, 10:57:52 AM
is this modification to make thumbnail bigger ? it's to small ?? if not how could I do that ?
This modification adds new BBC, it is not editing any options...
I'll try to edit mod in next few days to improve it and fix some errors whic I found...
Ok guys,
To keep the aspect ratio of the image while resizing it, I did this change to the mod.
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<name>Image Thumbnail BBCode</name>
<id>Tomahawk:Image_Thumbnail_BBCode</id>
<version>1.0</version>
<homepage>http://tomahawk.110mb.com</homepage>
<file name="$sourcedir/Subs.php">
<operation>
<search position="before"><![CDATA[
array(
'tag' => 'white',
'before' => '<span style="color: white;">',
'after' => '</span>',
),
]]></search>
<add><![CDATA[
array(
'tag' => 'imgt',
'type' => 'unparsed_content',
'content' => '<a href="$1" target="_blank"><img src="$1" width="25%" height="25%" border="0" /></a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),
]]></add>
</operation>
</file>
<file name="$themedir/Post.template.php">
<operation>
<search position="before"><![CDATA[
'flash' => array('code' => 'flash', 'before' => 'http://',%20'after'%20=>%20'', 'description' => $txt[433]),
]]></search>
<add><![CDATA[
'imgt' => array('code' => 'imgt', 'before' => '[imgt]', 'after' => '[/imgt]'),
]]></add>
</operation>
</file>
</modification>
Quote from: PanesarV on March 27, 2008, 11:46:09 PM
Ok guys,
To keep the aspect ratio of the image while resizing it, I did this change to the mod.
<?xml version="1.0"?>
<!DOCTYPE modification SYSTEM "http://www.simplemachines.org/xml/modification">
<modification xmlns="http://www.simplemachines.org/xml/modification" xmlns:smf="http://www.simplemachines.org/">
<name>Image Thumbnail BBCode</name>
<id>Tomahawk:Image_Thumbnail_BBCode</id>
<version>1.0</version>
<homepage>http://tomahawk.110mb.com</homepage>
<file name="$sourcedir/Subs.php">
<operation>
<search position="before"><![CDATA[
array(
'tag' => 'white',
'before' => '<span style="color: white;">',
'after' => '</span>',
),
]]></search>
<add><![CDATA[
array(
'tag' => 'imgt',
'type' => 'unparsed_content',
'content' => '<a href="$1" target="_blank"><img src="$1" width="25%" height="25%" border="0" /></a>',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
'disabled_content' => '($1)',
),
]]></add>
</operation>
</file>
<file name="$themedir/Post.template.php">
<operation>
<search position="before"><![CDATA[
'flash' => array('code' => 'flash', 'before' => 'http://',%20'after'%20=>%20'', 'description' => $txt[433]),
]]></search>
<add><![CDATA[
'imgt' => array('code' => 'imgt', 'before' => '[imgt]', 'after' => '[/imgt]'),
]]></add>
</operation>
</file>
</modification>
Thanks a lot bro, that worked wonderfully.
I'm trying to make this with gd... I had some poblems, but i think that i got solution, i'll test it when i get home...
GD Function would be great. Thanks.
can i use this mod for smf 1.1.5?
Hi somebody can help me?
I have this mod and I want mix with this other mod.
http://custom.simplemachines.org/mods/index.php?mod=771
The problem is the Display.template file
<![CDATA[
<td colspan="2" class="smalltext" width="100%">';
if (!empty($message['attachment']))
{
echo' <div style="overflow: auto; width: 100%;" >
<fieldset>
<legend><b>', $txt['Attached_files'], '</b></legend>
';
//check if there are really images to show as thubmnails
$has_image = false;
$no_image = false;
foreach ($message['attachment'] as $attachment)
{
if ($attachment['is_image'])
$has_image = true;
if (!$attachment['is_image'])
$no_image = true;
//we know there is an image and a non-image. So we can exit
if ($no_image && $has_image)
break;
}
//show text for images
if ($has_image)
echo '<b>', $txt['Thumbnails'], ':</b><br />';
//show the images
foreach ($message['attachment'] as $attachment)
{
if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
{
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" rel="lightbox"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a>';
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" target="_blank"><img style="margin:5px;" src="', $attachment['thumbnail']['href'], '" align="middle" alt="" id="thumb_', $attachment['id'], '" border="0" /></a>';
}
else
{
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" target="_blank"><img src="' . $attachment['href'] . ';image" align="middle" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /></a>';
}
}
}
//show text for other attached files
if ($no_image && $has_image)
echo '<br /><br /><b>', $txt['Other_attached_files'], ':</b><br />';
//show other attached files
foreach ($message['attachment'] as $attachment)
{
if (!($attachment['is_image']))
{
echo '
<br /><a href="' . $attachment['href'] . '"><img src="' . $settings['images_url'] . '/icons/clip.gif" align="middle" alt="*" border="0" /> ' . $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 '</fieldset>
</div>';
}
]]>
How I do that two mods working together at same time?
I'm loving this mod to death...
But When I replace the IMG tags with the IMGT ones to make the default tags use IMGT functionality, it also resizes the images users place in their signature....
Is there a way around this??
TIA!!
Robert
thanks, I seen this mod and got to thinking I could try making one and here is my first version.
http://custom.simplemachines.org/mods/index.php?mod=1220
im anxious to see what you guys say is wrong with it ;)
Quote from: RoRoo on May 28, 2008, 08:42:37 AM
I'm loving this mod to death...
But When I replace the IMG tags with the IMGT ones to make the default tags use IMGT functionality, it also resizes the images users place in their signature....
Is there a way around this??
TIA!!
Robert
I don't think that you can do this because you are replacing tags...
Quote from: Ikhsan4488 on May 01, 2008, 02:54:50 PM
can i use this mod for smf 1.1.5?
I just installed it on 1.1.5 and it seems to work fine. However, is there supposed to be a description of the function when you hover over the button? If so, maybe that fails in 1.1.5 because nothing happens when I hover over the new button.
Hi! Can anyone help me on this? I'm getting this error message:
8: Undefined index: description
File: ...default/languages/Post.english.php (main sub template - eval?)
Line: 982
I just installed the Thumbnail Image mod, so I imagine it has something to do with that. What can I do about this error, and does it harm anything other than load up my Error Log?
Also, is there any way to add a description of the function when you hover over the button?
In case anyone else needs this information...
I haven't gotten a response here, but I received some help on the 1.1.x board here (http://www.simplemachines.org/community/index.php?topic=249853.0).
The end result is that the mod works for the most part, but it seems to be missing some instructions to call up the description for the button. So there's no description when you hover over the button, and I'm not sure but every time someone either uses the button or maybe simply logs in to your forum it generates an error in your error log. I suppose if you don't get much traffic you could simply delete the errors every day or two but if you don't want to mess with that, don't install.
I like the mod, so I may keep it. But it would be great if this little bug could be fixed though.
See the following threads:
http://www.simplemachines.org/community/index.php?topic=249676.msg1619715#msg1619715 (http://www.simplemachines.org/community/index.php?topic=249676.msg1619715#msg1619715)
and the solution: http://www.simplemachines.org/community/index.php?topic=249853.msg1621812#msg1621812 (http://www.simplemachines.org/community/index.php?topic=249853.msg1621812#msg1621812)
Can I get some help on this with the image tag or something this is totally different then the other thumbnail topic right? has nothing to be done with attachments.