Page 1 of 3

How center an image in post??

Posted: Tue Jan 10, 2017 9:49 pm
by registrado
How to center an image in a post

Re: How center image in post??

Posted: Tue Jan 10, 2017 10:33 pm
by divingbrit
The way I do it, and there are proberly other ways , there is an extension to place the image 'inline' called
"Inline images in attachment"
And then use another extension 'Advance BBcode box to center image.

Sounds long winded, but its just a number of clicks

Re: How center image in post??

Posted: Wed Jan 11, 2017 10:22 am
by Mick
A simpler way is to use the custom BBCode Centre Align Text which, when it surrounds IMG tags, will centre an image in a post.

Example: [centre][img]http://mysite.com/images/smilies/icon_question.gif[/img][/centre]

Re: How center image in post??

Posted: Wed Jan 11, 2017 2:46 pm
by registrado
Before update 3.2 attachments-Images could now be placed in the center of any part of a post by using the [attachment=][/attachment] BBCode. Now version 3.2 all attachements-images in my forum are placed always at bottom of the post not as image, only as attached.

How can I place attachements-images centered in any part of the post: example:

Captura de pantalla 2017-01-11 a las 15.45.05.png

Re: How center image in post??

Posted: Wed Jan 11, 2017 3:23 pm
by divingbrit
Thats why I used the ext "Inline images in attachment", which is a quick method of making the image available, putting the code at the point of the curser, then using the BBcode to center the image.

If the code is wrongly put on the bottom of the page, just cut and paste where it is needed

Re: How center image in post??

Posted: Wed Jan 11, 2017 3:53 pm
by registrado
Since I upgraded to 3.2 I have hundreds of posts that now do not work with attached centered images.
I just need to center the attached images in the post. I need BBCODE works at attachaments.
I need bbcode that works with attachments, I think in version 3.2 it can not

Re: How center image in post??

Posted: Wed Jan 11, 2017 5:59 pm
by divingbrit
Sorry to hear that, but,I have just rechecked, and using 3.2 and ext 'inline images in attachment' with ext 'Advanced BBcode box" works fine for me

Hopefully someone else can suggest whats gone wrong.

Re: How center image in post??

Posted: Wed Jan 11, 2017 6:10 pm
by Mick
OK, let's step back a second here, @OP: your original post asked:
registrado wrote:
Tue Jan 10, 2017 9:49 pm
How to center an image in a post
Which was answered, but then:
registrado wrote:
Wed Jan 11, 2017 3:53 pm
Since I upgraded to 3.2 I have hundreds of posts that now do not work with attached centered images.
I just need to center the attached images in the post. I need BBCODE works at attachaments.
I need bbcode that works with attachments, I think in version 3.2 it can not
Which is a completely different issue.

Before 3.2 how did you center attachment images?

Can you list the extensions you're presently using?

Re: How center image in post??

Posted: Wed Jan 11, 2017 6:44 pm
by registrado
This is the problem: I can´t center attachment with BBCODE:

Code: Select all

[center]attachment[/center]
BBCODE for center image only works for center TEXT, not IMAGE. This only happens in phpbb version 3.2.
Version 3.1.10 works fine.

This is the problem:
Captura de pantalla 2017-01-11 a las 19.24.13.jpg
Extensions:
Captura de pantalla 2017-01-11 a las 19.50.32.png

Re: How center image in post??

Posted: Sat Jan 21, 2017 10:08 am
by paopevil
Find file "bbcode.html" in folder "template". Insert tag <center></center>.
343.jpg

Re: How center image in post??

Posted: Sat Apr 15, 2017 3:38 pm
by VSE
Actually this is an issue in phpBB 3.2.

You can not nest an inline attachment inside many BBCodes.

Put it in the CODE or LIST BBCodes and it breaks. Or any of the built in text formatting or custom BBCodes such as alignment codes.

The issue seems to be with the BBCodes that use a <span> element. If so, the inline attachment rendering seems to break (displaying: [attachment=0]Clipboard02.png[/attachment], and renders as plain text, and phpBB falls back to displaying the attachment in the non-inline way.

This is how [align=center][attachment=0]Clipboard02.png[/attachment][/align]is stored in the db:

Code: Select all

<r><ALIGN align="center"><s>[align=center]</s>[attachment=0]Clipboard02.png[/attachment]<e>[/align]</e></ALIGN></r>

Re: How center image in post??

Posted: Sun Apr 16, 2017 12:03 am
by 3Di
Actually, it doesn't center images also with css only, using URL&IMG tags. In 3.1 it does.

Re: How center image in post??

Posted: Sun Apr 16, 2017 1:54 am
by M.O.B.
Man! I'm really hoping we can figure out a solution to this issue. Perhaps phpBB developers need to figure out how to fix this???

I tend to use a lot the PLACE INLINE attachment feature button to place attached images centered on a topic, this way it looks a bit like a news page blog.

Here an example on phpBB 3.1.x using the newspage extension: http://www.mixingonbeat.com/phpbb/app.php/news -- plus when you then go to the main topic, you still see the attached inline image centered.

Basically using the following bbcode syntax:

Code: Select all

[center][attachment=1]image.png[/attachment][/center]
But now with phpBB 3.2 this is broken. Now it shows up like this:
center_inline_attachment_test_-_MattFriedman.me_-_2017-04-14_21.33.36.png
Notice how it just shows the text on the post where the attached inline image should be, and instead just places the attachment at the bottom.

WORKAROUND:
I did find a workaround, but it's going to take me ages to update all my sites that use this type of pattern -- plus since phpBB doesn't have a bbcode parser, I think I will have to open each post and then submit so the new changes take affect.

The workaround is to place it within a quote box:

Code: Select all

[quote][center][attachment=1]image.png[/attachment][/center][/quote]
Using the above example, it will look like this:
[Tip]_Factors_To_Consider_Quinceañera_Plus_Size_Dresses_-_My15Birthday_-_Quinceañera_Forum_-_2017-04-15_18.45.22.png
This is how the workaround quote fix looks like in the database for phpBB 3.2:

Code: Select all

<QUOTE><s>[quote]</s><CENTER><s>[center]</s><ATTACHMENT filename="Clipboard02.png" index="0"><s>[attachment=0]</s>Clipboard02.png<e>[/attachment]</e></ATTACHMENT><e>[/center]</e></CENTER><e>[/quote]</e></QUOTE>
So, I was wondering if we could study the quote feature in phpBB and also make the center bbcode act the same way, regardless of the code we place within?

P.S. I haven't gone live with phpBB 3.2 on all my sites. But the clock is ticking and I know I gotta update them soon, but this issue is killing me. I need help from the bbcode / phpBB Gods! :lol:

I think what phpBB devs should do is give us a placement option when placing an inline attachment in a post -- meaning being able to select if we want it centered and etc. This way, we don't need to use bbcode for that. Just a thought. -- Of course this will still kill me, because right now I got thousands of threads that are broke because inline attachments can't be centered using bbcode in phpBB 3.2. So if they add such a feature, I will spend years fixing them all.
paopevil wrote:
Sat Jan 21, 2017 10:08 am
Find file "bbcode.html" in folder "template". Insert tag <center></center>.

Image
The issue with this workaround, is that not all inline attachments need to be centered, like zip files, docs, and etc. Or other images that we place in a guide/tutorial type of page/post.

Re: How center an image in post??

Posted: Sun Apr 16, 2017 9:53 pm
by M.O.B.
UPDATE:

I started a Bug Tracker about this issue: https://tracker.phpbb.com/browse/PHPBB3-15177

It seems back in 2007 there was a similar bug: https://tracker.phpbb.com/browse/PHPBB3-5959

I don't think it has been officially reported to them--I did a search and could not find a recent report. I'm hoping they figure this out. I have tons of posts broken because of this issue. :(

If anyone has some php code they can offer to fix this, please let me know? I'm willing to use that code on my offline 3.2 site.

Re: How center an image in post??

Posted: Mon Apr 17, 2017 1:30 am
by M.O.B.
UPDATE 2:

Here is something odd.

When we add an inline image attachment on the post like this: (just like before)

Code: Select all

[center][attachment=0]Clipboard02.png[/attachment][/center]
And we press the "PREVIEW" button, we can see the image inline attachment being displayed and centered correctly.

Here is the HTML code that displays when in PREVIEW mode:

Code: Select all

<div align="center">
	<div class="inline-attachment">
		<dl class="thumbnail">
			<dt><a href="./download/file.php?id=316&amp;mode=view"><img src="./download/file.php?id=316&amp;t=1" class="postimage" alt="Clipboard02.png" title="Clipboard02.png (663.73 KiB) Viewed 22 times"></a></dt>
		</dl>
	</div>
</div>
It seems the issue is only when we press the SUBMIT button, it's when it displays it wrong.

Here is the HTML code that displays in SUBMIT mode:

Code: Select all

<div align="center">[attachment=0]Clipboard02.png[/attachment]</div>
So I am thinking that it's suppose to work, but there might be a bug somewhere in the code??

BTW, this is how it looks like in the database:

for phpBB 3.2:

Code: Select all

<CENTER><s>[center]</s>[attachment=0]Clipboard02.png[/attachment]<e>[/center]</e></CENTER>
for phpBB 3.1.10:

Code: Select all

[center:22citped][attachment=0:22citped]<!-- ia0 -->Clipboard02.png<!-- ia0 -->[/attachment:22citped][/center:22citped]
So it seems to be different! Why? I wonder if the database update process from phpBB 3.1.10 to 3.2 changed that? Anyone?