Attachments Positioning

Started by quake101, April 10, 2008, 11:06:49 PM

Previous topic - Next topic

erlend_sh

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.

CraftGeek

#41
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?

City Builder

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.

CraftGeek

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

City Builder

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.

kai920

#45
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?

kai920

#46
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 which is perfect, but cannot install because both make changes to display.template.php. I'll see if I can manually install it.

kai920

#47
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 :)

kai920

#48
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.

MeGaMeN

#49
uff, i heve your module on hxxp:www.itporadna.cz/index.php?topic=56.0 [nonactive] and more then 9 atachment problem :-/ can anybody help me? Thanx

Shortrnd

This mod is working great for me on version 1.1.5.  Thanks a ton!

digger

I'v fixed mod for SMF2 beta4 and add russian-utf8 lang


camfather

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  :-[

ChaosEnergy

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?
Chaos Empire ®

Chamaeleon

#54
I'v fixed mod for SMF 2.0 RC1.2 and add german lang

mkress

is it possible to extend ssi.php so that you can get attachments via ssi-function?

kai920

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">


Chamaeleon

#57
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"

kai920

I'm testing the Attachments in Messages 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.

Chamaeleon

package-info.xml .....updated  ;)

Advertisement: