Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-04-12 19:26:55
- typewriter
- New Member
- Registered: 2006-04-10
- Posts: 5
article image caption
How can i display the caption for images? I’ve searched both this forum and google but have not found any satisfactory explanations. I’m including one or more images in each article using the [txp:image id=“n” /] syntax. The image upload feature includes a method of attaching a caption to the image. How can i use it?
Note that i’m not looking for information about galleries. Nor am i looking for thumbnails which open the image in a new window. Also, zem_article_image wouldn’t work, as we need to have the images inline, between paragraphs. I looked at <a href=“http://textpattern.org/plugins/38/glximage”>glx_image</a>, though it does more than i need. Should i use that as a starting point to hack the source myself?
Have i missed something? Or is the caption there for administrative purposes only?
Offline
#2 2006-04-12 19:53:07
- typewriter
- New Member
- Registered: 2006-04-10
- Posts: 5
Re: article image caption
OK, i grokked glx_image and installed that. It works, but the img src is wrong. I tracked it down to this line:
$src = $pfr.$img_dir.’/’.$id.$ext;
The $pfr & $img_dir globals don’t seem to be set, so the path is completely wrong. Can anyone shed some light on why these might be empty/not set/missing?
Offline
#3 2006-04-12 20:35:31
- typewriter
- New Member
- Registered: 2006-04-10
- Posts: 5
Re: article image caption
Obviously, i didn’t grok this enough. Of course, $pfr & img_dir are set, i just wasn’t looking at the output closely enough. What i’m getting:
“/images/3.png”
What it *should be:
“/directory/subdirectory/images/3.png”
I found a mention of $pfr (path_from_root) in the function preText(), in publish.php. A comment there mentions that it’s been deprecated and was left in for plugin compatibility. The problem is, it’s not showing the correct path from root. Textpattern seems to believe this is “/”. Site URL (in the admin prefs) is correct, though (“domain/directory/subdirectory”).
So, is there some similar variable i can use that is always available, using Textpattern 4.0.2? I realise that this has gone way off-topic, but, seeing as i’m the only one posting so far…
Offline
#4 2006-04-12 20:55:02
- typewriter
- New Member
- Registered: 2006-04-10
- Posts: 5
Re: article image caption
Solved. I added $prefs t the global line and changed:
$src = $pfr.$img_dir.’/’.$id.$ext;
to:
$src = “http://${prefs[‘siteurl’]}/${img_dir}/${id}${ext}”;
Similar changes would be required for the next if block (“if (!empty($link))”.
Offline
Re: article image caption
Hello typerwriter
I only saw your post today, and one day I had the same need of yours : I’ve made a hack of the <code><txp:image /></code> for my own use, but if it can help you …
This plugin is named prad_image and you can find it here even if it’s in french, you’re able to understand his simple way to work.
<code><txp:prad_image id=“12” /></code>
<code><txp:prad_image name=“paris.jpg” textalt=“1” textcaption=“1” /></code>
It works like <code><txp:image /></code> with just the caption and the alternative text display in option with the oportunity to style caption and textalt with css.
françois
Offline
#6 2006-05-06 20:05:20
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: article image caption
There’s also upm_image.
Offline
#7 2006-05-23 11:37:05
- michaelwinter
- New Member
- Registered: 2006-05-22
- Posts: 9
Re: article image caption
Hello, fpradignac,
maybe I didn’t understand tag-structure (newbie). Therefore my question:
why is your tag divided up in two tags, where the first points to the image already
and the second containes additionally the image by its original name ?
Best regards,
Michael
Offline
Re: article image caption
Hello michaelwinter,
If I understand you, the 2 tags are just examples of different way to use the plugin :
<code><txp:prad_image id=“12” /></code> is the basic tag, just like TXP image tag.
<code><txp:prad_image name=“paris.jpg” textalt=“1” textcaption=“1” /></code> is an example to show that you can call an image not only by his id but with his name, etc.
But you just have to use one tag, the one that suits you.
Hope it will help you.
françois
Offline
Re: article image caption
It is also possible to use bos_image_display with art_img=1 capt=1 (with option to textilize=1 the caption) in your form to display article image with caption.
Bye
Z-
Offline
#10 2006-05-23 21:40:48
- michaelwinter
- New Member
- Registered: 2006-05-22
- Posts: 9
Re: article image caption
Hello fpradignac,
is this form:
<txp:prad_image id=“12” textalt=“1” textcaption=“1” />
possible too ?
michael
Offline
Re: article image caption
michaelwinter you must tag your code before posting.
Anyway, I found it in the page code source of this thread : <txp:prad_image id="12" textalt="1" textcaption="1" />
and yes it’s a “normal” uses.
françois
Offline
#12 2006-07-08 15:41:27
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: article image caption
Mary wrote:
There’s also upm_image.
Exactly.
I admit it took me a few attempts to figure it out but now I’ using a custom form image_caption:
<code><txp:upm_image image_id=”<txp:upm_img_id />” />
<p class=“caption”><txp:upm_img_caption /></p></code>
What had me flummoxed for quite a while was that I needed to click the link labelled custom in Mary’s image pop-up window. That will place a line like the following in the article:
<code><txp:upm_image image_id=“288” form=“image_caption” /></code>
I have a feeling that a lot of other users are looking for the answer to this one, too. Perhaps this could be added to the FAQ/Common How Do I… Questions?!
Cheers Martin
Offline