Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: quake101 on April 10, 2008, 11:06:49 PM

Title: Attachments Positioning
Post by: quake101 on April 10, 2008, 11:06:49 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1159)



ATTACHMENTS POSITIONING v1.2
By Quake101 (http://custom.simplemachines.org/mods/index.php?action=search;author=3847)


Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1159) | Comment On This Mod (http://www.simplemachines.org/community/index.php?topic=233640.0) | Donate (http://www.badassmustangs.com/forums/paypal.html)

Introduction
The mod adds the ability to position your attachments in your post using [attachment=1] bbcode
Where 1 is the first attachment in that post.
It is ONLY possible to position attachments which are tied to that POST only.

Features
o Adds [attachment=n] bbcode to position attachments within the post (where n is the number of the attachment in the post, eg first = 1, second = 2)
o Adds [Insert Attachment 1] next to each attachment/upload box to insert the bbcode.
o The default listing of attachments at the bottom of the post is unaffected.
o Text string is shown as alternative when quoted or in code
o Error Text string shown for invalid/missing/deleted attachments
o Reloads the attachments for Ajax Editing
o Text string shown in place of attachment for Recent posts/Previewing and Topic&Reply History

There are no admin settings with this mod.  To disable the mod you must uninstall it.

Installation
Simply install the package to install this modification on the SMF Default Core theme.
Manual edits will be required for other themes.

This mod is compatible with SMF 1.1.x and SMF 2.0 Beta 3 Public only.

Donate
Has this modification helped you? Support the developer by Donating (http://www.badassmustangs.com/forums/paypal.html)

Support
Please use the modification thread for support with this modification.

Changelog
0.5 BETA - 27th October 2007
o Initial release per request
1.0 - 30th October 2007
o First PUBLIC release
1.1 - 1st December 2007
o Fixed [Insert] link number
1.2 - 13 April 2008
o Fixed displaying of image attachments twice that use [attachment=n] bbcode
o Made 2.0 Beta 3 Public compatible
o Added Portuguese & Brazilian language support (Thanks joomlamz)
Title: Re: Attachments Positioning
Post by: kissa on April 11, 2008, 06:27:59 AM
Hi
Nice to see that someone, was willing to improve this mod.
Hav you fixed anything yet, or is this just the same version KarlBenson did?

Title: Re: Attachments Positioning
Post by: quake101 on April 11, 2008, 09:52:37 AM
Quote from: kissa on April 11, 2008, 06:27:59 AM
Hi
Nice to see that someone, was willing to improve this mod.
Hav you fixed anything yet, or is this just the same version KarlBenson did?

Kissa,

I just took over this mod from karlbenson and I'm currently working on the next release. This is the same version that karlbenson did, just released under my name. I hope to have the double displaying of image attachments fixed in the next release. I currently don't have a time line of when I'll have this fixed, but I'm hoping for 1/2 weeks. :)
Title: Re: Attachments Positioning
Post by: Apllicmz on April 11, 2008, 02:57:37 PM
nice
i translate portuguese & brazilian...

Thank you

<file name="$themedir/languages/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Anexo] ';
$txt['attachment_nopermission'] = ' [ Atalho: Você não está autorizado a visualizar anexos ] ';
$txt['attachment_invalid'] = ' [ Atalho inválido ou não existe ] ';
$txt['attachment_disabled'] = ' [ Anexos Desabilitados ] ';
$txt['attachment_insert'] = 'Inserir Atalho';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.portuguese-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Anexo ] ';
$txt['attachment_nopermission'] = ' [Atalho: Voc&#234; n&#227;o est&#225; autorizado a visualizar anexos ] ';
$txt['attachment_invalid'] = ' [ Atalho inv&#225;lido ou n&#227;o existe ] ';
$txt['attachment_disabled'] = ' [ Anexos Desabilitados ] ';
$txt['attachment_insert'] = 'Inserir Atalho';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Anexo] ';
$txt['attachment_nopermission'] = ' [ Atalho: Você não está autorizado a visualizar anexos ] ';
$txt['attachment_invalid'] = ' [ Atalho inválido ou não existe ] ';
$txt['attachment_disabled'] = ' [ Anexos Desabilitados ] ';
$txt['attachment_insert'] = 'Inserir Atalho';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Anexo ] ';
$txt['attachment_nopermission'] = ' [Atalho: Voc&#234; n&#227;o est&#225; autorizado a visualizar anexos ] ';
$txt['attachment_invalid'] = ' [ Atalho inv&#225;lido ou n&#227;o existe ] ';
$txt['attachment_disabled'] = ' [ Anexos Desabilitados ] ';
$txt['attachment_insert'] = 'Inserir Atalho';
]]></add>
</operation>
</file>
Title: Re: Attachments Positioning
Post by: Jacque on April 12, 2008, 10:52:56 AM
Can't wait for the double display fix.

Plans for 2.0 compatibility?
Title: Re: Attachments Positioning
Post by: rumfa on April 13, 2008, 08:07:52 AM
Hey, i would like to use the (attachment 1) as an file url. What line of code schould be changed to make this possible.
I would like to have the option to show whole images when i want in that way. Now all the images are cropped, while somethimes (when writing anarticle) i would like to show the whole pic. Doing it with an image url and placing it i (img) tag would be great...

So in place to copy the image and crop it to the post, i would use (attachments 1) as the file url only.
Title: Re: Attachments Positioning
Post by: quake101 on April 13, 2008, 11:10:33 PM
Version 1.2 has been released.
Title: Re: Attachments Positioning
Post by: ivo2296 on April 14, 2008, 02:12:39 PM
Quote from: quake101 on April 13, 2008, 11:10:33 PM
Version 1.2 has been released.

Any chance for upgrade from v1.1 to v1.2 without uninstalling v1.1? I would like manual to edit my files.

Thanks a lot!
Title: Re: Attachments Positioning
Post by: quake101 on April 14, 2008, 02:33:36 PM
Quote from: ivo2296 on April 14, 2008, 02:12:39 PM
Quote from: quake101 on April 13, 2008, 11:10:33 PM
Version 1.2 has been released.

Any chance for upgrade from v1.1 to v1.2 without uninstalling v1.1? I would like manual to edit my files.

Thanks a lot!

I had a feeling someone might ask this... I highly recommend the uninstall/install method as it is cleaner. For those who wish to edit their file manually may do the following:

Go to the mod download page (Here (http://custom.simplemachines.org/mods/index.php?mod=1159)). Select v1.2 of the package, then select what version of SMF you are currently running and press submit. This will display the package edits for your version of SMF.

The only changes made from v1.1 to v1.2 is ./Sources/Display.php and ./Themes/default/Display.template.php files.
Title: Re: Attachments Positioning
Post by: ivo2296 on April 14, 2008, 02:47:31 PM
Quote from: quake101 on April 14, 2008, 02:33:36 PM
Quote from: ivo2296 on April 14, 2008, 02:12:39 PM
Quote from: quake101 on April 13, 2008, 11:10:33 PM
Version 1.2 has been released.

Any chance for upgrade from v1.1 to v1.2 without uninstalling v1.1? I would like manual to edit my files.

Thanks a lot!

I had a feeling someone might ask this... I highly recommend the uninstall/install method as it is cleaner. For those who wish to edit their file manually may do the following:

Go to the mod download page (Here (http://custom.simplemachines.org/mods/index.php?mod=1159)). Select v1.2 of the package, then select what version of SMF you are currently running and press submit. This will display the package edits for your version of SMF.

The only changes made from v1.1 to v1.2 is ./Sources/Display.php and ./Themes/default/Display.template.php files.

Thanks, i asked cause the uninstall of v1.1 gave me error in Display.php but i deleted its code manually and now i have v1.2 which works perfect.

Thanks one more time for your time!
Title: Re: Attachments Positioning
Post by: ivo2296 on April 14, 2008, 03:08:35 PM
Again me :)

i got in forum's error log now:

http://www.xxxx.com/index.php?dummy=1&amp;topic=23849.320
8: Undefined index: dontshowattachment
File: /home/xxxx/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 523
Line: 514

P.S. That error comes when i view the old attachments before the installation of the mod.
Title: Re: Attachments Positioning
Post by: quake101 on April 14, 2008, 03:37:51 PM
Quote from: ivo2296 on April 14, 2008, 03:08:35 PM
Again me :)

i got in forum's error log now:

http://www.xxxx.com/index.php?dummy=1&amp;topic=23849.320
8: Undefined index: dontshowattachment
File: /home/xxxx/public_html/Themes/default/Display.template.php (main sub template - eval?)
Line: 523
Line: 514

P.S. That error comes when i view the old attachments before the installation of the mod.
Ahh, thanks for pointing that out. I fixed the current v1.2 package, please download and reinstall.
Title: Re: Attachments Positioning
Post by: ivo2296 on April 14, 2008, 04:16:26 PM
Now it seems to be OK :)
Title: Re: Attachments Positioning
Post by: Croco on April 15, 2008, 01:51:20 PM
the insert attachment seems not to work with WYSIWYG editor can anyone confirm this ?
Title: Re: Attachments Positioning
Post by: quake101 on April 15, 2008, 02:10:18 PM
Quote from: ^_^ on April 15, 2008, 01:51:20 PM
the insert attachment seems not to work with WYSIWYG editor can anyone confirm this ?

What version of SMF?
Title: Re: Attachments Positioning
Post by: Croco on April 15, 2008, 04:39:52 PM
2.0 Beta 3 public
Title: Re: Attachments Positioning
Post by: quake101 on April 15, 2008, 04:50:58 PM
You are correct. When the WYSIWYG editor is enabled on SMF 2.0 Beta 3 Public, the insert attachment link does not work. I'm currently working on this bug and hope to have it fixed soon. Current workaround is to disable the WYSIWYG editor.
Title: Re: Attachments Positioning
Post by: kissa on April 16, 2008, 02:04:10 AM
Thank You  :)

Title: Re: Attachments Positioning
Post by: FragaCampos on April 16, 2008, 11:03:47 AM
Hello there. Thanks a lot for taking over this mod.

I had karlbenson's version installed and everytime i used the tags i had the same attach repeated twice in the same post, in the post, and below the post.
I thought you had already fixed this
QuoteFixed displaying of image attachments twice that use [attachment=n] bbcode
, but i just installed it and i see that it still happens. I have the attachment's link in and below the post.
Title: Re: Attachments Positioning
Post by: quake101 on April 16, 2008, 12:22:36 PM
If you are not using the default theme you will need to manually edit your Display.template.php
Title: Re: Attachments Positioning
Post by: FragaCampos on April 16, 2008, 01:44:34 PM
But I am using default theme...  :(
Title: Re: Attachments Positioning
Post by: quake101 on April 16, 2008, 02:09:39 PM
I just re-read your original post and I'm a little confused. What version of the mod do you currently have installed? Version 1.2 should have corrected this problem. If you do have v1.2 installed will you please attach the following 2 files from your forum:
./Sources/Display.php
./Themes/default/Display.template.php
Title: Re: Attachments Positioning
Post by: FragaCampos on April 16, 2008, 07:07:48 PM
Yes, i have version 1.2 installed.

Thanks for trying to see what's going on.
Here goes the 2 files you asked.
Title: Re: Attachments Positioning
Post by: quake101 on April 16, 2008, 10:44:55 PM
Quote from: FragaCampos on April 16, 2008, 07:07:48 PM
Yes, i have version 1.2 installed.

Thanks for trying to see what's going on.
Here goes the 2 files you asked.


That's odd, the mod installed successfully, in fact I uploaded the files you attached to my test server and it worked. Will you post or PM me a url of a thread that's doing this?
Title: Re: Attachments Positioning
Post by: quake101 on April 17, 2008, 07:36:35 AM
Are you using IE7? I think I found a bug when using IE7. I'm still looking into this.
Title: Re: Attachments Positioning
Post by: FragaCampos on April 17, 2008, 09:33:28 AM
It's really odd, i'm using firefox 2.0.0.13.

You can see it in this (http://www.docspt.com/index.php?topic=57.0) link, the tag is below the first image.
Title: Re: Attachments Positioning
Post by: quake101 on April 17, 2008, 10:01:43 AM
Quote from: FragaCampos on April 17, 2008, 09:33:28 AM
It's really odd, i'm using firefox 2.0.0.13.

You can see it in this (http://www.docspt.com/index.php?topic=57.0) link, the tag is below the first image.

The attachment is not an image and the mod currently only stops the displaying image attachment twice. I could add to the next version so any attachment that uses the bbcode will not display twice.
Title: Re: Attachments Positioning
Post by: FragaCampos on April 17, 2008, 07:51:17 PM
Ah, ok. I thought this version added that feature already. My bad.

It would be a major improvement to hide the bottom attachment though, in case of bbcode use ;)

(btw, I didn't quite understand what do you mean about "displaying the image attachment twice"... :P)
Title: Re: Attachments Positioning
Post by: City Builder on April 20, 2008, 05:25:11 PM
It's a very nice mod.

But two things come to mind:
1. Lightbox intergration, seems that when I use the attachment1 or whatever attachment in the post the lightbox is ignored.  Would be nice if it didn't.  tHIS MAY be beyond your control however and fall on the author of the intergrate lighbox mod instead.

2. When I turn off showing attachements at the bottom of the post in the admin panel, it also shuts off the attachment image as well, it would be nice if when someone uses the attachement # insert that it removes it from the bottom of the post.

3rd, nothing to do with this mod, but would be nice if the attachements at the bottom of each message went horizontal instead of vertical, much less scrolling that way.

Overall nice mod, but would like to see lightbox intergratation, and the turning off attachement showing not turning off the attachment # in the posts.
Title: Re: Attachments Positioning
Post by: quake101 on April 20, 2008, 10:10:44 PM
Lightbox intergration is planed for the next release.
Title: Re: Attachments Positioning
Post by: mark7144 on April 21, 2008, 01:23:37 PM
Quote from: City Builder on April 20, 2008, 05:25:11 PM
it would be nice if when someone uses the attachement # insert that it removes it from the bottom of the post.
I feel unless that is implemented then this mod is seriously flawed, so I can't really use this mod until then :(

It's rediculous that if I choose to insert my attachments into my post, the post is then double the size with duplicate images.

Quote from: quake101 on April 17, 2008, 10:01:43 AM
the mod currently only stops the displaying image attachment twice.
It does? Not for me - when I upload an attachment and then do [attachment=1] it will show twice in the post.
Title: Re: Attachments Positioning
Post by: quake101 on April 21, 2008, 02:10:30 PM
Quote from: mark7144 on April 21, 2008, 01:23:37 PM
Quote from: City Builder on April 20, 2008, 05:25:11 PM
it would be nice if when someone uses the attachement # insert that it removes it from the bottom of the post.
I feel unless that is implemented then this mod is seriously flawed, so I can't really use this mod until then :(

It's rediculous that if I choose to insert my attachments into my post, the post is then double the size with duplicate images.

Quote from: quake101 on April 17, 2008, 10:01:43 AM
the mod currently only stops the displaying image attachment twice.
It does? Not for me - when I upload an attachment and then do [attachment=1] it will show twice in the post.

What theme? The package will only edit the default theme.
Title: Re: Attachments Positioning
Post by: mark7144 on April 21, 2008, 02:20:25 PM
Oh I see... I'm running it on Saf-Blue but I assumed it installed fully because the functionality works.

Can you tell me what needs to be manually changed on my theme then?
Title: Re: Attachments Positioning
Post by: quake101 on April 21, 2008, 02:39:15 PM
Go to the mod download page (Here (http://custom.simplemachines.org/mods/index.php?mod=1159)). Select v1.2 of the package, then select what version of SMF you are currently running and press submit. This will display the package edits for your version of SMF.

You need to edit Display.template.php for your theme
Title: Re: Attachments Positioning
Post by: mark7144 on April 21, 2008, 03:26:27 PM
Thanks.
Title: Re: Attachments Positioning
Post by: City Builder on April 21, 2008, 07:45:15 PM
I did the manual edits to the required files, but yet when I attach an image to a post, then use the [attachment=1], indeed the image shows up in the place of the [attachment=1] tag but it continues to show at the bottom of the post as well.

I wonder if I missed some edit that needs to be made in the Display.template.php file?
Title: Re: Attachments Positioning
Post by: quake101 on April 21, 2008, 08:02:44 PM
Quote from: City Builder on April 21, 2008, 07:45:15 PM
I did the manual edits to the required files, but yet when I attach an image to a post, then use the [attachment=1], indeed the image shows up in the place of the [attachment=1] tag but it continues to show at the bottom of the post as well.

I wonder if I missed some edit that needs to be made in the Display.template.php file?

You may have, you should test the default theme and see if it's working. If so you can open both files and compare the edits.
Title: Re: Attachments Positioning
Post by: City Builder on April 22, 2008, 12:59:47 AM
Of course you are correct.  In the default core theme when placing the attachments inside of the post they disapear from the bottom of the message, I will lok to see what I missed.  Thank you and sorry for the bother.
Title: Re: Attachments Positioning
Post by: City Builder on April 23, 2008, 07:38:53 PM
Ok, I think I found and did it right.  Should I still have the text links at the bottom of the message though?  I got rid of the photos at the bottom but I've still got text links down there which don't bother me any and if they are supposed to be there then good enough, otherwise I'll keep plugging away until I get rid of them too if they're not supposed to be there.

Thanks,
Title: Re: Attachments Positioning
Post by: Matthew Schenker on May 04, 2008, 10:51:54 AM
Hello,
I am trying to install this modification in SMF 2.0 beta 3.1.  I get this error:The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

What am I doing wrong?

Matthew
Title: Re: Attachments Positioning
Post by: erlend_sh on May 11, 2008, 05:29:36 PM
Quote from: Matthew Schenker on May 04, 2008, 10:51:54 AM
Hello,
I am trying to install this modification in SMF 2.0 beta 3.1.  I get this error:The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

What am I doing wrong?

Matthew
Got the same thing.
Title: Re: Attachments Positioning
Post by: CraftGeek on June 03, 2008, 07:18:03 PM
Help!

I am using the Blue Vista theme so I have to manually edit the files. However when I copy the code from the web site to paste into my files, none of the spaces or returns get copied to my memory for pasting.
For example:

// Attachment Positioniong Mod: Start if (empty($modSettings['attachmentEnable']) || !allowedTo('view_attachments')) { $pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ; $output['body'] = preg_replace($pattern, $txt['attachment_nopermission'], $output['body']); } else { // GRACEFULLY REPLACE ATTACHMENTS INSIDE QUOTES OR CODE TAGS WITH THE TEXT STRING [ ATTACHMENT ] // WE MAY NEED TO DO THIS FOR POSTS *WITHOUT* ANY ATTACHMENTS if(preg_match_all('#<div class="(code|quote)">(.*?)</div>#im'. ($context['utf8'] ? 'u' : ''), $output['body'], $quotecode, PREG_PATTERN_ORDER)) { $quotecode = array_unique($quotecode[0]); // GO THROUGH EACH QUOTE/CODE ELEMENT $pattern = '#\[attachment=([0-9])\]#i'.($context['utf8'] ? 'u' : '') ; foreach ($quotecode as $a => $b) { $c = $b; $c = preg_replace($pattern, $txt['attachment'], $c); $output['body'] = str_replace($b, $c, $output['body']); } unset($a,$b,$c,$quotecode,$pattern); } // HOW MANY ATTACHMENTS ARE THERE? $z = count($output['attachment']); // NO ATTACHMENTS, SO WE CAN AVOID THIS PART if ($z != 0) { // NOW REPLACE OUR ATTACHMENT BBCODE WITH THE ATTACHMENTS for($i=0;$i<$z;$i++) { $attachment = $output['attachment'][$i]; if(strpos($output['body'],'[attachment='.($i+1).']') !== FALSE) { $replace = '<div class="smalltext">'; if ($attachment['is_image']) { // Don't display image attachments that use the bbcode twice $context['dontshowattachment'][$i+1] = $attachment['id']; if ($attachment['thumbnail']['has_thumb']) { $replace .= ' <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 { $replace .= ' <img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />'; } } $replace .= '<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'] . '.)</div>'; $output['body'] = str_replace('[attachment='.($i+1).']',$replace, $output['body']); } unset($replace); } } // GRACEFULLY REPLACE BBCODE FOR ANY INVALID/MISSING/DELETED ATTACHMENTS WITH ERROR TEXT STRING $pattern = '#\[attachment=([0-9a-z\#\-_ ]{1,10})\]#i'.($context['utf8'] ? 'u' : '') ; $output['body'] = preg_replace($pattern, $txt['attachment_invalid'], $output['body']); } // Attachment Positioniong Mod: End

That was a direct copy and paste of the code that is supposed to go into the Display.php file.

What do I do now?
Title: Re: Attachments Positioning
Post by: City Builder on June 03, 2008, 07:19:58 PM
Upload the file somewhere on your server (in ASCII mode) then download it and open it, this is usually what I do when this happens to me and then the spaces and lines are preserved.  I can't say it will work, but it's worth a try.
Title: Re: Attachments Positioning
Post by: CraftGeek on June 03, 2008, 10:17:41 PM
OK, now I am confused. ???  Happy, but confused. ??? :P ???

I remember reading that if I was using a theme other than default that I would have to do all the file editing manually, so I never tried the install. Till now. Because I couldn't get the cut & past working I did the install to see if it would do some of the work for me. After the install, I found that all the features are working fine! And I am using the Blue Vista theme!

So, Now I can say:
THANKS! This is a great mod and I realy do appreciat the quick responses.

Sean
Title: Re: Attachments Positioning
Post by: City Builder on June 03, 2008, 11:19:03 PM
Some mods work only on the core functions of SMF and don't need to change the template files, others do need to change the tempate files.  It's always best to try the install first and see which files need to be hand edited instead of doing a complete manual install everytime in my opinion.
Title: Re: Attachments Positioning
Post by: kai920 on June 05, 2008, 10:42:06 AM
I like this mod a lot. THANKS quake101!

PS. Does SMF allow more attachments according to group level? For example my forum is set at 4 attachments per post... can I set moderators to have 10 per post?
Title: Re: Attachments Positioning
Post by: kai920 on June 09, 2008, 07:34:53 AM
quake101: any plans to include an option to have the images outputted to be floated either left or right? perhaps with some xhtml markup so that they can be styled with css.
Managed to do this but have another question. See below

also, would it be possible to remove the caption text ("IMG_0146.JPG (77.63 KB. 1024x768 - viewed 0 times.)") beneath each image without massive modification of the core code?
Managed to remove in display.php

edit : found this mod (http://custom.simplemachines.org/mods/index.php?mod=771.0) which is perfect, but cannot install because both make changes to display.template.php. I'll see if I can manually install it.
Title: Re: Attachments Positioning
Post by: kai920 on June 09, 2008, 11:17:41 AM
After a brief look at display.php, I managed to float the images left by inserting a class="smf_attachment" in the <img> statement and adding the corresponding CSS. (see floated.png)

New question: Is there a way to "clear" the images without manually pressing "enter" inside the editor? As seen in smf.png, I had to press enter 6 times before the text would clear the images.

Thanks :)
Title: Re: Attachments Positioning
Post by: kai920 on June 10, 2008, 01:31:01 AM
Sorry - another question... is it me or does this mod ignore the "Max width of posted pictures" setting? I posted some pics and the width was higher than the set 600px.
Title: Re: Attachments Positioning
Post by: MeGaMeN on July 11, 2008, 02:51:23 AM
uff, i heve your module on http://www.itporadna.cz/index.php?topic=56.0 and more then 9 atachment problem :-/ can anybody help me? Thanx
Title: Re: Attachments Positioning
Post by: Shortrnd on July 18, 2008, 03:03:00 PM
This mod is working great for me on version 1.1.5.  Thanks a ton!
Title: Re: Attachments Positioning
Post by: digger on November 11, 2008, 10:41:54 PM
I'v fixed mod for SMF2 beta4 and add russian-utf8 lang

Title: Re: Attachments Positioning
Post by: camfather on December 08, 2008, 01:29:21 AM
Quote from: digger on November 11, 2008, 10:41:54 PM
I'v fixed mod for SMF2 beta4 and add russian-utf8 lang

Thanks, installed well.

Is there a way to make the attachments go next to each other to form a grid rather then have them stack on top of each other?

I'm new and stupid here  :-[
Title: Re: Attachments Positioning
Post by: ChaosEnergy on January 04, 2009, 02:19:06 PM
Quote from: quake101 on April 20, 2008, 10:10:44 PM
Lightbox intergration is planed for the next release.
Hi
now its around 8 month later, will there be a newer version with lightbox working, or did anyone fix it, and can post what needs to be done?
Title: Re: Attachments Positioning
Post by: Chamaeleon on July 21, 2009, 06:25:04 PM
I'v fixed mod for SMF 2.0 RC1.2 and add german lang
Title: Re: Attachments Positioning
Post by: mkress on July 25, 2009, 04:48:11 AM
is it possible to extend ssi.php so that you can get attachments via ssi-function?
Title: Re: Attachments Positioning
Post by: kai920 on July 29, 2009, 10:26:58 AM
Quote from: Chamaeleon on July 21, 2009, 06:25:04 PM
I'v fixed mod for SMF 2.0 RC1.2 and add german lang

Thanks for this, 2 things:

1) Does quick edit work for you? After I save I need to refresh to see changes. (If I uninstall this mod, quick edit works as normal)

2) package-info.xml file needs to be updated or else won't uninstall properly on 2.x :

<uninstall for="1.1 - 1.1.99">

Title: Re: Attachments Positioning
Post by: Chamaeleon on July 29, 2009, 11:09:01 AM
Quote from: kai920 on July 29, 2009, 10:26:58 AM
1) Does quick edit work for you? After I save I need to refresh to see changes. (If I uninstall this mod, quick edit works as normal)

the same  ::)

Quote from: kai920 on July 29, 2009, 10:26:58 AM
2) package-info.xml file needs to be updated or else won't uninstall properly on 2.x :
<uninstall for="1.1 - 1.1.99">

<version>1.2</version>
    <!--// Install for SMF 1.1.x versions only //-->
    <install for="1.1 - 1.1.99">
<readme type="file" parsebbc="true">readme.txt</readme>
<modification>install-1.1.x.xml</modification>
</install>
    <!--// Uninstall for SMF 1.1.x versions only //-->
    <uninstall for="1.1 - 1.1.99">
<modification reverse="true">install-1.1.x.xml</modification>
</uninstall>


    <!--// Install for 2.0 RC1.2 //-->
    <install for="2.0 RC1.2">
        <readme type="file" parsebbc="true">readme.txt</readme>
        <modification>install-2.0 RC1.2.xml</modification>
    </install>
    <!--// Uninstall for 2.0 RC1.2 //-->
    <uninstall for="2.0 RC1.2">
        <modification reverse="true">install-2.0 RC1.2.xml</modification>
    </uninstall>


for="1.1 - 1.1.99"  +   for="2.0 RC1.2"
Title: Re: Attachments Positioning
Post by: kai920 on July 29, 2009, 01:49:45 PM
I'm testing the Attachments in Messages (http://custom.simplemachines.org/mods/index.php?mod=1179) mod now. While the AJAX quick edit also does not load the images, at least any text changed does re-load properly.

Re: XML - does it uninstall properly for you? Because for me it was trying to undo the 1.1.x edits, leading to numerous failed tests.
Title: Re: Attachments Positioning
Post by: Chamaeleon on July 29, 2009, 03:37:38 PM
package-info.xml .....updated  ;)
Title: Re: Attachments Positioning
Post by: ttuu on August 06, 2009, 08:15:16 AM
when i click in Insert Attachment i see error in the page. the error says:

error: editor_type is not defined
file: http://ladaat.net/forum/Themes/default/script.js?fin11
line: 116


line 116 in script.js is:

// Replaces the currently selected text with the passed text.
function replaceText(text, textarea)
{
[color=red]if(editor_type==1){[/color]
text=BBCodeToHTML(text);
WriteHTML(text,"editor");
}
else{
WriteTEXT(text,"editor");
}
}


thanks for help
Title: Re: Attachments Positioning
Post by: GrayFiend on August 10, 2009, 12:26:23 PM
It's good mod. Thank to author. :)
I had translated it to Russian. I hope it will be helpful for someone:

<file name="$themedir/languages/Modifications.russian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Вложение ] ';
$txt['attachment_nopermission'] = ' [ Вложение: не хватает прав для просмотра этой информации ] ';
$txt['attachment_invalid'] = ' [ Вложение повреждено или более не существует ] ';
$txt['attachment_disabled'] = ' [ Вложения запрещены правилами форума ] ';
$txt['attachment_insert'] = 'Вставить в текст тег #';
]]></add>
</operation>
</file>
<file name="$themedir/languages/Modifications.russian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['attachment'] = ' [ Вложение ] ';
$txt['attachment_nopermission'] = ' [ Вложение: не хватает прав для просмотра этой информации ] ';
$txt['attachment_invalid'] = ' [ Вложение повреждено или более не существует ] ';
$txt['attachment_disabled'] = ' [ Вложения запрещены правилами форума ] ';
$txt['attachment_insert'] = 'Вставить в текст тег #';
]]></add>
</operation>
</file>




EDIT: hmm, seems in code I had pasted it in same charset. :-\
Ok, thying with attached files.
Title: Re: Attachments Positioning
Post by: marko_andres on December 19, 2009, 10:00:16 AM
works on 1.1.11?
Title: Re: Attachments Positioning
Post by: FragaCampos on December 19, 2009, 10:51:53 AM
Yes, i have it on my SMF 1.1.11 forum.
Title: Re: Attachments Positioning
Post by: teos55 on December 20, 2009, 12:01:09 PM
 SMF 1.1.11   PDX-DK  1.1.9.v1

Modifications :
1.     Bot Buster      1.1       
2.    RSS Feed Icon    1.1    
3.    Aeva ~ Auto-Embed Video & Audio    7.0 
4.    Ad Managment    2.3.1    
5.    SMF 1.0.19 / 1.1.11 Update    
6.    Hide Info Center From Guests    
7.    Google Analytics Code    1.1    
8.    TinyPortal    1.083    
9.    SMF Gallery Lite    2.0.9 
10.    Attachments Positioning    1.2

  Recently installed Attachment poisitioning 1.2   
  Now receiving so many ; 

8: Undefined index: attachment_invalid
File: /usr/hosts2/domains/karavanturk194/www.karavanturk.org/httpdocs/Sources/Display.php
Line: 968


  Lines 966-970 from /sources/display.php ; 
// GRACEFULLY REPLACE BBCODE FOR ANY INVALID/MISSING/DELETED ATTACHMENTS WITH ERROR TEXT STRING
      $pattern = '#\[attachment=([0-9a-z\#\-_ ]{1,10})\]#i'.($context['utf8'] ? 'u' : '') ;
      $output['body'] = preg_replace($pattern, $txt['attachment_invalid'], $output['body']);
   }
    // Attachment Positioniong Mod: End



  Having diffuculty to identify the error.  Users can see the attchments but the error log is full of with this message.
Can you pls shed some light on this ?
All the best
Oğuz


 
Title: Re: Attachments Positioning
Post by: ChaosEnergy on December 27, 2009, 10:16:17 AM
please upgrade to a 2.0 rc2 version, or i cant update one of my forums whereit got used a lot :)
Title: Re: Attachments Positioning
Post by: Acer1 on January 13, 2010, 07:19:37 AM
I search the mod for SMF RC2 !!!! Help!!!!!!!!!!!!  :o :o

Hope the Mod is Updatet in Time !
Title: Re: Attachments Positioning
Post by: Acer1 on January 27, 2010, 07:58:46 AM
Hmmm  Help !!!!!!!!!!!!!! This Mod in RC2 !!!!!!!!!!! Please !
Title: Re: Attachments Positioning
Post by: Acer1 on January 31, 2010, 01:49:39 PM
 :'( :'( Nobody can Help ??????   :'( :'(
Greets Acer
Title: Re: Attachments Positioning
Post by: program5 on February 08, 2010, 06:38:57 AM
Has anyone tested to see if this works with RC2 ?
Title: Re: Attachments Positioning
Post by: Acer1 on March 03, 2010, 01:20:58 PM
When i take the Mod for RC2 i have a problem.... when i have click "more attachment insert" the mod show me the Attachment insert

Sorry for my bad English

Title: Re: Attachments Positioning
Post by: recived on March 04, 2010, 03:20:29 AM
please upgrade to a 2.0 rc2 version. Блин ну чо когда нить додемся апдейт мода тоооо.
Title: Re: Attachments Positioning
Post by: gbsothere on March 04, 2010, 02:35:01 PM
For anyone who cares, by removing this:

<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'] . '.)

from the Display.php, all the attachments details, such as name, size, number of times viewed, etc., (along with the paper clip icon) are removed from beneath each attachment.  It is then also possible to place text between each attached image. 

My forum is version 1.1.11; it should work for 2.x, but I've not tested it out.

Just passing it along; it was important to our forum.  It may not be to yours.

:)
Title: Re: Attachments Positioning
Post by: gbsothere on March 05, 2010, 02:07:29 PM
Quote from: kai920 on June 09, 2008, 11:17:41 AM
After a brief look at display.php, I managed to float the images left by inserting a class="smf_attachment" in the <img> statement and adding the corresponding CSS. (see floated.png)




kai920, if you return to this thread, would you elaborate a bit on how, exactly, you did this? 

(Or if any coder stops by who knows, I'd appreciate the input.)


1.1.11, Default
Title: Re: Attachments Positioning
Post by: program5 on March 10, 2010, 08:50:35 AM
Why would anyone want to show attachments like defult ?
Quote from: Bugo on February 23, 2010, 03:39:29 PM
Try this package. For SMF 2.0 RC2

Bugo, sorry but it did not worked for me.
And I dont understand why SMF insists on showing attachmets in a vertical order.

Title: Re: Attachments Positioning
Post by: RawDepth on March 13, 2010, 11:02:02 PM
Will there be support for RC3?

Since I updated my forum this mod will not re-install.
Title: Re: Attachments Positioning
Post by: RawDepth on April 12, 2010, 09:19:50 PM
Apparently the author has abandoned this mod and is not updating it.  >:(

Can't we get old, unsupported mods removed from this forum?

Does anyone know of a mod to position attachments within the text of a post? (Ah...that works with RC3)

Please?

Anyone?
Title: Re: Attachments Positioning
Post by: Mave on April 20, 2010, 06:13:25 AM
For 2.0 rc3 above
http://www.simplemachines.org/community/index.php?topic=376767.msg0#new
Title: Re: Attachments Positioning
Post by: RawDepth on April 22, 2010, 07:55:37 PM
Quote from: Mave on April 20, 2010, 06:13:25 AM
For 2.0 rc3 above
http://www.simplemachines.org/community/index.php?topic=376767.msg0#new

Wow!

A thousand thank you's.

This is exactly what I needed.

I do genuinely appreciate it.
Title: Re: Attachments Positioning
Post by: program5 on May 12, 2010, 09:45:45 AM
BUMP !
Still no solution for rc3 ?
Title: Re: Attachments Positioning
Post by: ukhalik2 on May 31, 2010, 04:42:23 AM
please make this one compatible for 2.0 rc3
Title: Re: Attachments Positioning
Post by: gbsothere on June 21, 2010, 08:04:23 PM
I realize that this is an outdated mod and not actively supported, but I am hoping that some code-savvy member might offer some insight as to why I'm having the issue in question.

SMF 1.1.11 Default

For quick parsing reference, the mod link is here:
http://custom.simplemachines.org/mods/index.php?mod=1159 (http://custom.simplemachines.org/mods/index.php?mod=1159)

Version 1.2 parses for 1.1.11.

Here is the issue and stay with me; I'll try to be clear.

Say you want to attach three images.  This is how you do it:

Click Additional Options, then browse to your image, click [Insert Attachment 1] which will place this tag in your reply box:  [attachment=1].  This tag will become the image when you actually post.  Now... on to the second and third images:  you must first click [more Attachments] before proceeding.  A second browsing field will open and, after navigating to your image, you will click [Insert Attachment 2] which will place the tag [attachment=2] in your reply box.  Click [more Attachments] to open a third browsing field, click [Insert Attachment 3] which results in the [attachment=3] tag and you're ready to post your images.  All well and good...

Now, for the problem.  Say you decide you're not happy with image 1.  You click Modify and Additional Options and uncheck the first attachment and remove the [attachment=1] tag from your post and click Save.  Will the image simply be gone?  No.  It will, instead, be replaced by this ugly text in your post:  [ Attachment Invalid Or Does Not Exist ].  (Not only that, but the last image gets placed below your post, rather than within it.  Same thing if you're happy with image 1 and 3, but want to delete image 2 and go through the process of unchecking the second attachment and removing [attachment=2] from your post and clicking Save.  You will get [ Attachment Invalid Or Does Not Exist ] in place of the deleted image and the last image (3) will be placed beneath your post, rather than within it.  However.....   if it's only the very last image you want to delete.... only the last one, you understand.... and you uncheck that last image and remove [attachment=3] from your post, there is no ugly [ Attachment Invalid Or Does Not Exist ] and no image gets placed at the bottom of your post.

So......   it's a sequence thing, right?  If the sequence is interrupted in any way (with the exception of the very last attachment) the ugly text and bottom-placement of an image happens.  But if only the last image is deleted, all is well.  Yes, a sequence thing or no, that's not it?

:-\


Can anyone see anythinig at all in the parsing for 1.1.11 that might cause the interruption of a sequence to yield [ Attachment Invalid Or Does Not Exist ] within a post and placement of the last image below it?

Please do mull it over and, if you have any ideas, any help at all would be appreciated.   :)
Title: Re: Attachments Positioning
Post by: gbsothere on June 22, 2010, 03:10:12 PM
*stops back by, still wearing a toolbelt and carrying a hammer*

Okay, here's the work-around:

Replace or delete anything you like, when editing your post.  Just make sure that the [attachment=1] (and so on) tags in your post are numbered in succession, beginning with 1 and ending with the number matching the total number of images posted.  Just change the numbers in the tags to make them remain in succession and you're good to go.

*shrug*

I can live with that....   
Title: Re: Attachments Positioning
Post by: samurai-lupin on October 03, 2010, 04:58:58 AM
Has anybody ever found out how to use the lightbox on this?

Thanks ....
Title: Re: Attachments Positioning
Post by: deansmar on October 06, 2010, 06:23:29 AM
for all those that would like there Attachments Horizontal insted of vertical, this has been tested with SMF2 RC3, there is no errors in the error Log.

i have moded my Display.template.php, and added some text in my language file, plus installed this mod jQLightbox.0.5.1, which makes everything lightbox enabled, and the attachments are horizontal

as in the photo attached to this post.

firstly:
install the jQLightbox.0.5.1 Mod  (http://custom.simplemachines.org/mods/index.php?mod=1605) i know it does not mention that its for SMF2 RC3, but i assure you it does work on RC3

then:
the language changes were in Modifications.english.php copy and paste this in there
// Attachment layout
$txt['Attached_files'] = 'Attached files';
$txt['Other_attached_files'] = 'Other attached file(s)';
$txt['Thumbnails'] = 'Thumbnail(s) click on Image to enlarge';


then:
upload my display.template.php, either into your theme or the default theme

any other changes can be made in the CSS to change the looks..

don't forget to make backups first, hope you all enjoy..
Title: Re: Attachments Positioning
Post by: samurai-lupin on October 06, 2010, 07:24:07 AM
Hello, I have the JS Viewer on my site but it doesn't take effect when using the attachment positioning mod. Do you have any suggestions on what to change in the mod so the lightbox takes effec? Thanks!
Title: Re: Attachments Positioning
Post by: deansmar on October 06, 2010, 07:33:44 AM
firstly i do not know what JS Viewer is ??

i would imaging the reason beheind the lightbox not taking effect, is that the image link is not calling the  rel="lightbox" link..
Title: Re: Attachments Positioning
Post by: samurai-lupin on October 07, 2010, 07:32:37 PM
Thanks for your advice. I have been successfull in implementing the viewer. However I have one more problem: The mod will keep on displaying all images positioned into the posting again on the bottom - but the 1st one ?! ... however I think that ANY image inserted into the posting by using the image attachment positioning mod should NOT be repeated on the bottom.

Has anybody any thought how to fix this problem? Thanks!
Title: Re: Attachments Positioning
Post by: timned88 on October 21, 2010, 09:44:40 PM
Quote from: ukhalik2 on May 31, 2010, 04:42:23 AM
please make this one compatible for 2.0 rc3

yes, i agree.  please make this rc3 compatible.
Title: Re: Attachments Positioning
Post by: yol on August 02, 2012, 12:30:17 PM
Could anybody fix that issue?


Quote from: samurai-lupin on October 07, 2010, 07:32:37 PM
Thanks for your advice. I have been successfull in implementing the viewer. However I have one more problem: The mod will keep on displaying all images positioned into the posting again on the bottom - but the 1st one ?! ... however I think that ANY image inserted into the posting by using the image attachment positioning mod should NOT be repeated on the bottom.

Has anybody any thought how to fix this problem? Thanks!
Title: Re: Attachments Positioning
Post by: FragaCampos on January 22, 2013, 12:59:56 PM
Can anybody make this compatible with SMF 2.0.3 please?
Title: Re: Attachments Positioning
Post by: dougiefresh on May 22, 2013, 07:09:15 PM
I took the liberty of making this add-on compatible with 2.0.4, since I'm hoping to also use it with my forum :P  This mod consists of a few changes from 2.0 Beta 3 Public to make it work with 2.0.4, no new features....  Thought I'd share my few minutes of work  ;D Enjoy....

EDIT: Removed attachment.
Title: Re: Attachments Positioning
Post by: mark7144 on July 08, 2013, 05:08:02 PM
Does anyone know how to have this show in ssi News? It just shows the code instead of the image.
Title: Re: Attachments Positioning
Post by: dougiefresh on July 28, 2013, 07:27:06 PM
Someone would probably have to rewrite the mod so that the additional processing takes place in the parse_bbc function in Sources/Subs.php.  Right now, the additional processing for inline attachments takes place in Sources/Display.php after the call to parse_bbc....

EDIT: It also takes place in Sources/Posts.php for post editing (at least I think it's post editing).  Also, a way to get at the attachments would be necessary to develop, as well...
Title: Re: Attachments Positioning
Post by: kkmixs on November 19, 2013, 02:20:13 AM
I have install inline atachement, even it install well.But it is showing an option to inline attachement for my first attachement only.I m not getting an option for my other attachement.Please check the image attached the image inline attachement is there with first attachement only.

Further, it appear if after making the post i refresh the page.

Please help me how to add in line attachement options to all my attachement.

I m using version 2.0.5 with core theme
Title: Re: Attachments Positioning
Post by: jm_araujo on December 22, 2013, 09:23:00 AM
Attached is updated version compatible with 2.0.6, works fine in my forum.
It's mostly based on the original code, only made changes where compatibility where broke, so all credits must go to original author.
Feel free to use my version as you please.
Title: Re: Attachments Positioning
Post by: PML100 on March 22, 2014, 09:40:39 AM
Quote from: kkmixs on November 19, 2013, 02:20:13 AM
I have install inline atachement, even it install well.But it is showing an option to inline attachement for my first attachement only.I m not getting an option for my other attachement.Please check the image attached the image inline attachement is there with first attachement only.

Further, it appear if after making the post i refresh the page.

Please help me how to add in line attachement options to all my attachement.

I m using version 2.0.5 with core theme

Did you ever find a solution to this, I have the same problem too.

Title: Re: Attachments Positioning
Post by: dougiefresh on August 11, 2014, 07:47:01 PM
Quote from: dougiefresh on July 28, 2013, 07:27:06 PM
Someone would probably have to rewrite the mod so that the additional processing takes place in the parse_bbc function in Sources/Subs.php.  Right now, the additional processing for inline attachments takes place in Sources/Display.php after the call to parse_bbc....

EDIT: It also takes place in Sources/Posts.php for post editing (at least I think it's post editing).  Also, a way to get at the attachments would be necessary to develop, as well...
My Post and PM Inline Attachments (http://custom.simplemachines.org/mods/index.php?mod=3770) mod, which I wrote from the ground up, has been approved for a little while.  It takes care of many of the issues that I have with this mod....