News:

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

Main Menu

How can I have text wrap around images?

Started by JeffP, January 25, 2012, 06:03:55 PM

Previous topic - Next topic

JeffP

When I add an image to a post it always gets left aligned and text does not wrap around.

Is there any way to have an image in a post be aligned to either the left or right and have the text wrap around it?

Arantor

Look on the mod site for the 'float bbcode', that way you can set whether an image should be set to the left or right and text will move around it. (Provided you use the float bbcode to put the image in, that is)
Holder of controversial views, all of which my own.


Mick.

This is for 1.1 smf series.  I parsed it and its doable manually.   What seems to be a little different its the post.template.php

http://custom.simplemachines.org/mods/index.php?mod=631

Arantor

1.1 had to modify the Post.template.php to add buttons to the editor, as of 2.0 RC2 it was done in the Subs-Editor.php file.
Holder of controversial views, all of which my own.


Mick.

Forget post.template.php.

I have this on my 2.0



open:
Themes/default/languages/Modifications.english.php

Find:
?>

add before:

$txt['float'] = 'Float';



Open:
Sources/Subs.php

Find:

array(
'tag' => 'ftp',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_ftp new_win" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'ftp://\') !== 0 && strpos($data, \'ftps://\') !== 0)
$data = \'ftp://\' . $data;
'),
),


add before:

array(
'tag' => 'float',
'type' => 'unparsed_equals',
'test' => '(left|right)\]',
'before' => '<div style="float: $1; margin: .5ex 1ex 1ex 1ex;">',
'after' => '</div>',
),


Open:
Sources/Subs-Editor.php

Find:

array(
'image' => 'img',
'code' => 'img',
'before' => '[img]',
'after' => '[/img]',
'description' => $txt['image']
),


add after:

array(
'image' => 'float',
'code' => 'img',
'before' => '[float=left][img]',
'after' => '[/img][/float]',
'description' => $txt['float']
),


Make sure you upload an icon .gif for the bbc button in Themes/default/images


Mick.

Quote from: Arantor on January 25, 2012, 06:14:51 PM
1.1 had to modify the Post.template.php to add buttons to the editor, as of 2.0 RC2 it was done in the Subs-Editor.php file.

Youre right. I had to look it up in my own forum ;)

JeffP

Thanks for all the fast replies.
At this stage I am not comfortable with hacking code so looks like I will wait until the mod is updated or some other simpler method comes up.
Thanks again.

Arantor

Good luck waiting for the mod to be updated. If it hasn't been updated for 2.0 RC2 (which is over 2 years old) I doubt it'll be updated any time soon.
Holder of controversial views, all of which my own.


mashby

Quote from: JeffP on January 25, 2012, 08:05:14 PM
Thanks for all the fast replies.
At this stage I am not comfortable with hacking code so looks like I will wait until the mod is updated or some other simpler method comes up.
Thanks again.
If you're not comfortable doing the code edits, you can attach the three files to a reply and I can do them for you (unless someone else does it faster).
Always be a little kinder than necessary.
- James M. Barrie


mashby

Always be a little kinder than necessary.
- James M. Barrie

Mick.

There you go. Same thing man. I didn't know nibogo made one.

JeffP

Sadly, the mod is not compat with version 2.02 which is what I am running.


Mick.

Quote from: JeffP on January 25, 2012, 09:12:18 PM
Sadly, the mod is not compat with version 2.02 which is what I am running.


load the mod. Don't install it yet. At the bottom of the mod list, you'll see 'advanced'. Click it and then type whatever the mod is for. Smf 2.0 or Smf 2.0.1 whatever it is and save. Then find the mod in the list and install. Wolla

Bhavadasa

Quoteload the mod. Don't install it yet. At the bottom of the mod list, you'll see 'advanced'. Click it and then type whatever the mod is for. Smf 2.0 or Smf 2.0.1 whatever it is and save. Then find the mod in the list and install. Wolla

Perfect!  I tried it with Smf 2.0.2, and it works!!! Thanks...that just put an end to a lot of searching!

Advertisement: