Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-06 09:55:53

ultramega
Member
Registered: 2006-02-26
Posts: 221

How do I... Show caption of image?

First time ever (after making few… txp-sites) I’d like to show caption below article image. Do I really need a plugin to pull caption for the image?

Offline

#2 2009-05-06 12:32:34

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How do I... Show caption of image?

There’s no native Txp tag that will do it. The caption automatically appears in the title attribute of the img tag with any Txp image tag, so you could use javascript to display it on its own.


Code is topiary

Offline

#3 2009-05-06 12:46:38

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: How do I... Show caption of image?

Or you can use a plugin

yab_image
upm_image


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#4 2009-05-06 13:36:59

jens31
Plugin Author
From: munich / dtschermani
Registered: 2008-08-25
Posts: 183
Website

Re: How do I... Show caption of image?

i recommend you use upm_image. i dont know the other one, but i use upm image a zillion times a week..

Offline

#5 2009-05-06 20:10:36

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: How do I... Show caption of image?

or you could use soo_image ;)


Code is topiary

Offline

#6 2009-05-07 08:07:29

ultramega
Member
Registered: 2006-02-26
Posts: 221

Re: How do I... Show caption of image?

Thanks guys. I hope some of those plugins work with MLP

Offline

#7 2009-05-07 22:02:26

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: How do I... Show caption of image?

ultramega wrote:

Thanks guys. I hope some of those plugins work with MLP

upm_image does for sure :)

Offline

#8 2009-05-14 16:10:55

bg
Member
From: Pekin Illinois USA
Registered: 2005-02-20
Posts: 22
Website

Re: How do I... Show caption of image?

Or you could use a custom field and the plugin smd_if like this…

<txp:smd_if field="article_image" operator="isused">
	<div class="articleImage">
	<txp:article_image />
	<br />
	<span class="imageCaption"><txp:custom_field name="image_caption" /></span>
	</div> <!-- //articleImage -->
</txp:smd_if>

The plugin detects whether or not you have an article image and if so, whether or not there’s a caption for it. Then it renders your article accordingly.

Note the div class=“articleImage” in the above code. I style this to center the article image below my article headline and above the body content. Something like…

.articleImage {
	width: 500px;
	margin: 0 auto;
	text-align: center;
}

… will do it.

The “imageCaption” class is used to style the text of the caption so it’s different from the article body.

You can see it on a site I’m developing at the Olympus E620 Blog

Last edited by bg (2009-05-14 16:35:27)


— Bob

Offline

#9 2009-05-14 16:41:32

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: How do I... Show caption of image?

That’s darn clever, BG.


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

Board footer

Powered by FluxBB