PrettyPhoto on [img] tags

Modifications for phpBB3.
Try the Mods here and share Your own Mods
Forum rules
You dont have to use ModX or make your mod AutoMod compatible. A simple textfile is fine
But if you post Mods here You also have to give support
User avatar
Dragosvr92 Offline
BBCoder II
BBCoder II
Posts: 21
Joined: 28 May 2011, 14:53
Local time: Sunday 12:48
Last active: -
Favourite EXT: Please Wait
Location: Romania

Re: PrettyPhoto on [img] tags

Post by Dragosvr92 »

I know that. i was saying that its not a safe way of doing it :|
User avatar
Stoker Online
Site Admin
Site Admin
Posts: 4,295
Joined: 12 May 2008, 21:26
Local time: Sunday 11:48
Last active: Online now
Favourite EXT: Forum Goal
Location: Denmark

Re: PrettyPhoto on [img] tags

Post by Stoker »

Its 100% safe.
The question was how to do it on IMG tags and that is exactly what the code does.

But you can also create a bbcode and use that instead of the IMG code.
~ The greatest achievement in life is to inspire ~
Regards Stoker
User avatar
Stoker Online
Site Admin
Site Admin
Posts: 4,295
Joined: 12 May 2008, 21:26
Local time: Sunday 11:48
Last active: Online now
Favourite EXT: Forum Goal
Location: Denmark

Re: PrettyPhoto on [img] tags

Post by Stoker »

Create this bbcode:

BBCode usage:

Code: Select all

[sigimg]{URL}[/sigimg]
HTML replacement:

Code: Select all

<img src="{URL}" alt="" />
Display on posting page: Yes

Now we need to make sure this bbcode is used when your users is creating their signature.
We can achieve this by replacing the default IMG bbcode with the custom bbcode we just created.

Open styles/prosilver/template/posting_buttons.html
Find:

Code: Select all

<!-- IF S_BBCODE_IMG -->
		<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" />
	<!-- ENDIF -->
Replace with:

Code: Select all

<!-- IF S_BBCODE_IMG -->
	<!-- IF $SIG_EDIT -->
	<!-- BEGIN custom_tags -->
	<!-- IF custom_tags.BBCODE_TAG eq 'sigimg' -->
		<input type="button" class="button2" name="addbbcode{custom_tags.BBCODE_ID}" value="Img" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" />
	<!-- ENDIF -->
	<!-- END custom_tags -->
	<!-- ELSE -->
		<input type="button" class="button2" accesskey="p" name="addbbcode14" value="Img" style="width: 40px" onclick="bbstyle(14)" title="{L_BBCODE_P_HELP}" />
	<!-- ENDIF -->
	<!-- ENDIF -->
~ The greatest achievement in life is to inspire ~
Regards Stoker
User avatar
mobius Offline
BBCoder II
BBCoder II
Posts: 23
Joined: 17 Dec 2011, 08:35
Local time: Sunday 09:48
Last active: -

PrettyPhoto on [img] tags

Post by mobius »

first of all thanks. this particular thing helped me a lot. here are few things I found along the way:

The second tweak is based on using the phpbb3 premod release here meaning you have the prettyphoto mod and bbcodeboxlite

1: Open includes/bbcode.php this particular edit I had to modify to this:

Code: Select all

				'img'		=> '<a href="$1" rel="prettyPhoto[group1]" title="" ><img src="$1" alt="' . $user->lang['IMAGE'] . '" class="onerror" width="100" /></a>',
reasons are that here rel="prettyPhoto[group1]" by adding a group all images using the code on the page are seen as a group and you can use the prettyphoto popup to view next image and stuff (like with attachments here and in your mod). the same thing applies to the bbcodes for youtube. Oddly though if you click on a video first it will only see other videos and ignore images, but if you click on an image it see all of the group ( like 1/10 ). second, add title="" so you remove the Udefined error in the name.

EDIT : i read the phpbb3 forum where you posted this mod about groups and stuff. it was then I realised that doing this means all images across all posts will be a group. not a huge problem just not as refined. maybe there is a way to make this edit use a variable that uses the post id?
prettyphoto1.jpg
second part. Your edit to not resize sigs seems to have come before the bbcodebox lite mod. Since it breaks the styling of the IMG button in the profile and stuff so I did this to fix it.

Code: Select all

<!-- IF S_BBCODE_IMG -->
   <!-- IF $SIG_EDIT -->
   <!-- BEGIN custom_tags -->
   <!-- IF custom_tags.BBCODE_TAG eq 'sigimg' -->
      <input type="button" class="buttonz" name="addbbcode{custom_tags.BBCODE_ID}" value="" style="background: url('{ROOT_PATH}images/editor/image.png');" onclick="bbstyle({custom_tags.BBCODE_ID})" title="{custom_tags.BBCODE_HELPLINE}" />
   <!-- ENDIF -->
   <!-- END custom_tags -->
   <!-- ELSE -->
      <input type="button" class="buttonz" accesskey="p" name="addbbcode14" value="" style="background: url('{ROOT_PATH}images/editor/image.png');" onclick="bbstyle(14)" onmouseover="helpline('p')" onmouseout="helpline('tip')" />
   <!-- ENDIF -->
   <!-- ENDIF -->

You do not have the required permissions to view the files attached to this post.