Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-28 18:30:52

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

align AND thumbnail for images

Hello!

I’m working on migration from the Concrete5 (non-profi org) site to Txp and lot of articles use (mostly) centered images, but I need smaller size instead of original ones.

Had problems with centering images and therefore tried with yab_image plugin which has:

align="center"

attribute, but it seems that it cannot work with thumbnails like txp:thumbnail tag.

My question is if you can recommend some plugin which can display thumbnail of the image as well as center it (without too much styling) or how to do it without plugins?

Sincerely,
Gour

Offline

#2 2013-02-28 19:16:50

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: align AND thumbnail for images

I think if you enclose <txp:thumbnail class=“myclass” /> in <p> tags, which Textile can do for you, then apply .myclass {text-align:center;} to the CSS, you will get the desired result. If you are using <txp:smd_thumbnail /> to mass produce the smaller size images the same principle applies (not checked by me).

Offline

#3 2013-02-28 19:44:35

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: align AND thumbnail for images

joebaich wrote:

I think if you enclose <txp:thumbnail class=“myclass” /> in <p> tags, which Textile can do for you, then apply .myclass {text-align:center;} to the CSS, you will get the desired result.

Thank you for the hint.

By inspecting CSS styles I found out there is already:

img.align-center {
  display: block;
  margin: 1em auto;
}

style, so just using:

<txp:thumbnail id="xy" class="align-center"/>

solved the issue. :-)

Offline

#4 2013-02-28 21:28:07

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: align AND thumbnail for images

Also, in Textile you can use these formatters:

Paragraph range left:

p<. some text

Paragraph range right:

p>. some text

Paragraph centred:

p=. some text

Paragraph justified:

p<>. some text

Inline image floated left:

!<http://your-image-url.png!

Inline image floated right:

!>http://your-image-url.png!

Inline image blocked centre:

!=http://your-image-url.png!

Hope that helps.

Offline

#5 2013-02-28 22:37:44

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: align AND thumbnail for images

philwareham wrote:

Also, in Textile you can use these formatters:
[…]
Hope that helps.

Yeah, I saw some of those mentioned in the ‘book’, but the authors do not recommend using those ‘cause they using inline styles or mixing content with the presentation, so I wonder if you consider that the solution which I deployed (using class attribute) is better in that regard?

Offline

#6 2013-03-01 16:33:48

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: align AND thumbnail for images

A class is always better than an inline style. To avoid specificity problems and allowing you to use media queries and stuff like that.

When it comes to mixing content with presentation though, you are already polluting your content by adding a proprietary Textpattern tag into article text, so the argument is pretty moot.

Offline

#7 2013-03-01 21:11:42

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: align AND thumbnail for images

philwareham wrote:

When it comes to mixing content with presentation though, you are already polluting your content by adding a proprietary Textpattern tag into article text, so the argument is pretty moot.

Good argument, although I’ve to say that the code produced by Textile really rocks in comparison with wysiwyg editors…similar to Textpattern in comparison with other CMS-es.

The more I use it – the more I’m happy and it leaves everything what I tried (and tried a lot) firmly in the dust!!

Offline

Board footer

Powered by FluxBB