Replace [img]-tag?

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Suggested Hosts
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
Brf
Support Team Member
Support Team Member
Posts: 51997
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Replace [img]-tag?

Post by Brf »

It looks like you can probably use that. Replace the existing code with yours. Replace {URL} with $1

Just be aware that that code will not work if a user uses
[url=www.example.com][img]image.jpg[/img][/url]
because you would end up with nested links, one for your image and one for their url.

King-Nothing
Registered User
Posts: 458
Joined: Sat Oct 06, 2007 6:14 pm

Re: Replace [img]-tag?

Post by King-Nothing »

Old thread, but I finally tested this.

When using the bbcode, all old images where automatically "converted" into Higjslide. But when posting a new image using the IMG-tag, only a small grey box appears and no image.

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

Which lightbox are you actually using? They mostly work purely on JavaScript, so they most probably could be adjusted to just pick all the images in each post and then do what they're intended to. This way you'd have no (serious) modifications at all - just an additional JS file to be included in viewtopic_body.html.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

King-Nothing
Registered User
Posts: 458
Joined: Sat Oct 06, 2007 6:14 pm

Re: Replace [img]-tag?

Post by King-Nothing »

I`m using Highslide Attachment Mod: http://www.phpbb3bbcodes.com/viewtopic.php?f=8&t=13

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

That was a challenging one. The following instructions are meant for the prosilver style (but could work with any style) and have been tested in FireFox 3.5.5 only so far. It will create a lightbox gallery with fancy JS animations for all pictures in a post. Smilies are ignored (at least those which have a path component of /smilies/).

Download Highslide. Create a folder /styles/highslide/ and extract the contents of the folder highslide/ from inside the archive there (so you end up having the file /styles/highslide/highslide-with-gallery.js). In fact, you don't need to extract all the files - only the folder graphics/ and the files highslide.css, highslide-ie6.css and highslide-with-gallery.js are needed. Obviously you should never install a phpBB style/theme with the name "highslide".

Open /styles/prosilver/template/overall_header.html and find:

Code: Select all

</head>
Before, add:

Code: Select all

<link rel="stylesheet" type="text/css" href="styles/highslide/highslide.css" />
Open /styles/prosilver/template/viewtopic_body.html and find:

Code: Select all

<!-- BEGIN postrow -->
Before, add:

Code: Select all

<script type="text/javascript" src="styles/highslide/highslide-with-gallery.js"></script>
<script type="text/javascript"> //<![CDATA[
	hs.graphicsDir= 'styles/highslide/graphics/';
	hs.wrapperClassName= 'wide-border';

	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = true;

	// Add the controlbar
	hs.addSlideshow({
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			opacity: 0.75,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});

	function extendImg( e ) {
		var eA, eI, iE, iCnt, eL= e.childNodes;
		for( iE= 0, iCnt= eL.length; iE< iCnt; iE++ ) {
			if( eL[iE].tagName&& eL[iE].tagName.toLowerCase()== 'img'&& !eL[iE].src.match( /\/smilies\// ) ) {
				eI= document.createElement( 'img' );
				eI.setAttribute( 'style', 'max-height: 100px; max-width: 100px;' );
				eI.src= eL[iE].src;
				eA= document.createElement( 'a' );
				eA.href= eI.src;
				eA.className= 'highslide';
				eA.setAttribute( 'onclick', 'return hs.expand( this )' );
				eL[iE].parentNode.replaceChild( eA, eL[iE] );
				eA.appendChild( eI );
			} else extendImg( eL[iE] );
		}
	}
//]]>
</script>
Find:

Code: Select all

			<div class="content">{postrow.MESSAGE}</div>
Replace with:

Code: Select all

<div id="m{postrow.POST_ID}" class="content"><div class="highslide-gallery">{postrow.MESSAGE}</div></div>
<script type="text/javascript"> //<![CDATA[
	extendImg( document.getElementById( 'm{postrow.POST_ID}' ) );
//]]>
</script>
Purge your templates cache.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Replace [img]-tag?

Post by Jabhi »

I already have these edits with highslide attachment mod.
styles/prosilver/template/overall_header.html
Find :

Code: Select all

<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
After add :

Code: Select all

<script type="text/javascript" src="{ROOT_PATH}highslide/highslide-full.js"></script>
<link href="{ROOT_PATH}highslide/highslide.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
// <![CDATA[
hs.graphicsDir = '{ROOT_PATH}highslide/graphics/';
hs.align = 'center';
hs.transitions = ['expand', 'crossfade'];
hs.outlineType = 'rounded-white';
hs.fadeInOut = true;
//hs.dimmingOpacity = 0.75;

// Add the controlbar
hs.addSlideshow({
	//slideshowGroup: 'group1',
	interval: 5000,
	repeat: false,
	useControls: true,
	fixedControls: 'fit',
	overlayOptions: {
		opacity: 0.75,
		position: 'bottom center',
		hideOnMouseOut: true
	}
});
// ]]>
</script>
styles/prosilver/template/attachment.html
Find :

Code: Select all

			<dt><a href="{_file.U_DOWNLOAD_LINK}"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a></dt>
Replace with :

Code: Select all

			<dd class="highslide-gallery"><a href="{_file.U_DOWNLOAD_LINK}/{_file.DOWNLOAD_NAME}" class="highslide" onclick="return hs.expand(this, { slideshowGroup: '{_file.THUMB_POST_ID}' })"><img src="{_file.THUMB_IMAGE}" alt="{_file.DOWNLOAD_NAME}" title="{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}" /></a><div class="highslide-caption">{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}</div></dd>
And includes/functions_content.php
Find :

Code: Select all

						'THUMB_IMAGE'		=> $thumbnail_link,
After add :

Code: Select all

						'THUMB_POST_ID'      => $attachment['post_msg_id'],
So what are the further edits, Thanks.
Go phpBB go... Respected : Developers, Supporters.

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

If you only use my modifications all [img] tags and all pictures as inline attachments are affected. If you want that behaviour, undo your (previous) modifications.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Replace [img]-tag?

Post by Jabhi »

Okey, Thank you ...
Go phpBB go... Respected : Developers, Supporters.

Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Replace [img]-tag?

Post by Jabhi »

Still it opens twice ...

susy.netai.net/viewtopic.php?f=2&p=4

Edit : Sorry that was my problem, All working fine except attached images are opening in smaller size. Thanks.
Go phpBB go... Respected : Developers, Supporters.

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

Because you still have modifications in /styles/prosilver/template/attachment.html unrelated to my instructions.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Replace [img]-tag?

Post by Jabhi »

I corrected it, Please check the site and CTRL+F5 . The attached images are opens as small images, not in its original size.
But the image with bb code works fine.
Another problem, It counts all image in a topic instead of counting a single post.
Go phpBB go... Respected : Developers, Supporters.

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

  1. Highslide can't download - it just operates on directly accessible pictures.
  2. Your attached images are not inline attached, so we are only seeing previews/thumbnails at 100% (which are files on their own), whereas the originals would be a download.
  3. The [img] inserted picture is already an original - it is just displayed zoomed (in other words: you don't see it in 100%).
Do you now understand why the scenario just is like it is?

As for having galleries per post: do you still want that or do you realize that Highslide won't make you happy?
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
Mick
Support Team Member
Support Team Member
Posts: 22431
Joined: Fri Aug 29, 2008 9:49 am
Location: Cardiff

Re: Replace [img]-tag?

Post by Mick »

Also, for these type of requests you should be asking in the MODs forums not support.
"The more connected we get the more alone we become" - Kyle Broflovski©

Jabhi
Registered User
Posts: 572
Joined: Mon Feb 27, 2012 6:12 am

Re: Replace [img]-tag?

Post by Jabhi »

AmigoJack wrote:
  1. Your attached images are not inline attached, so we are only seeing previews/thumbnails at 100% (which are files on their own), whereas the originals would be a download.
Sorry, but how to attach inline, I did like below
-uploaded the image
-click place inline. Is that inline attach ?
Mick wrote:Also, for these type of requests you should be asking in the MODs forums not support.
Sorry for that, But i am not the topic starter, AmigoJack asked me to reply here, So I replied ...
Go phpBB go... Respected : Developers, Supporters.

User avatar
AmigoJack
Registered User
Posts: 5715
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Replace [img]-tag?

Post by AmigoJack »

Jabhi wrote:-uploaded the image
-click place inline. Is that inline attach ?
Yes, it is. Sorry, I mixed it up with a setting in ACP > Posting > Attachments > Attachment settings > Image category settings [Assigned extension group: Images] > Create thumbnail which must be No, so no thumbnails are created. Set it and create another test post.
Jabhi wrote:i am not the topic starter, AmigoJack asked me to reply here
I'm sure Mick is referring either to your original post or to your "Another problem". But I understand that if you're not aware of the concepts and terminology you also don't know how to classify your need exactly (and thus create a post/topic at the appropriate place).
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

Locked

Return to “[3.0.x] Support Forum”