Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How do I link article image thumbnails directly to article images?
Maybe I’m overly complicating this but I’m building a photoblog using textpattern and thickbox and I just want to have thumbnails of my article images linking directly to the full-sized article image. The only way I have come across doing this so far is via a little php directly in the template like below (snagged from a solution to a different problem, but cannibalized for my needs). Is there any way to do this via built in textpattern tags or plugin tags without having to resort to all this gobbly gook?:
<txp:php>global $thisarticle; $site = 'http://'.$GLOBALS['siteurl']; $pic = $thisarticle['article_image']; $titre = $thisarticle['title'];
echo( "<a href=\"".$site."/images/".$pic.".jpg\" title=\"".$titre."\" class=\"thickbox\"><img src=\"".$site."/images/".$pic."t.jpg\" alt=\"\" title=\"Click To Enlarge\" /></a>" );
</txp:php>
Last edited by The Human Museum (2007-01-22 17:51:06)
“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum
Offline
#2 2007-01-22 18:55:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I link article image thumbnails directly to article images?
With upm_image you can output the image url. I don’t know thickbox, but if it’s like lightbox and slimbox, you might find a combination of upm_image and wet_for_each_image come in handy. For my slimbox galleries I’m using this code example.
Offline
Re: How do I link article image thumbnails directly to article images?
Thanks for the help!
For anyone else who is interested in using thickbox in this application I used the following code as my upm_img_popper form:
<a href="<txp:upm_img_full_url />" title="<txp:title />" class="thickbox"><img src="<txp:upm_img_thumb_url />" width="<txp:upm_img_thumb_width />" height="<txp:upm_img_thumb_height />" alt="Click To Enlarge" title="Click To Enlarge" /></a>
“I was born to hustle roses down the avenues of the dead.” – Charles Bukowski
The Human Museum
Offline
Re: How do I link article image thumbnails directly to article images?
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#5 2007-02-02 16:42:37
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: How do I link article image thumbnails directly to article images?
I can’t seem to use the custom tags for upm_image. Here is my code:
<txp:upm_article_image type="image" limit="1"><a href="<txp:upm_img_full_url />" title="<txp:title />" rel="lightbox[Slide Show]"><img src="<txp:upm_img_thumb_url />" width="<txp:upm_img_thumb_width />" height="<txp:upm_img_thumb_height />" alt="Click To Enlarge" title="Click To Enlarge" />Photo Gallery</a></txp:upm_article_image>
And here is the error I get:
tag_error <txp:upm_img_full_url/> -> Textpattern Notice: upm_image: invalid context, tag must be used within the tag as a wrapper or from its own form called by the tag. on line 521
tag_error <txp:upm_img_thumb_url/> -> Textpattern Notice: upm_image: invalid context, tag must be used within the tag as a wrapper or from its own form called by the tag. on line 521
tag_error <txp:upm_img_thumb_width/> -> Textpattern Notice: upm_image: invalid context, tag must be used within the tag as a wrapper or from its own form called by the tag. on line 521
tag_error <txp:upm_img_thumb_height/> -> Textpattern Notice: upm_image: invalid context, tag must be used within the tag as a wrapper or from its own form called by the tag. on line 521
Any suggestions?
Offline
Re: How do I link article image thumbnails directly to article images?
I think the tags need to be in a form. I don’t think UPM image can be used as a container tag.
And not everything you want but most of it. I’m open to new attribute suggestions. The rel was added exactly so Jamie (Soulship) could integrate it with Lightbox/Thickbox
<txp:hak_article_image link="1" linktype="image" rel="thickbox" />
It’s not the swiss army knife that upm_image is though.
Shoving is the answer – pusher robot
Offline
#7 2007-02-02 17:30:45
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: How do I link article image thumbnails directly to article images?
I have tried it using the form option and I get exactly the same errors. I am using hak_article elsewhere on the site, but I really need to enclose a text link with the image link in the same <a> element which I can’t seem to do with hak_article. Basically I want an image and a text link to trigger the Lightbox code. The only way I can think of doing this is wrapping both the image and the text in the <a> element. I am open to fresh ideas though.
Offline
#8 2007-02-02 18:21:41
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I link article image thumbnails directly to article images?
You have a better chance of getting an adequate reply if you post your question in the plugin thread.
Offline
Re: How do I link article image thumbnails directly to article images?
MonkeyNotes Try this out and see if it works hak_article_image_v0.5.2.1.txt
I made a hak_article_image work as a container tag so everything between the tags will get included inside the link. Haven’t tested it extensively but if it works for ya I’ll post it up as an official update.
you can now do
<txp:hak_article_thumb link="1" linktype="image" rel="thickbox">Photo Gallery</txp:hak_article_thumb>
It will take other <txp: />
tags inside it too.
Let me know if it helps.
Shoving is the answer – pusher robot
Offline
#10 2007-02-03 04:27:00
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How do I link article image thumbnails directly to article images?
I responded to the problem with my plugin here.
Offline
#11 2007-02-03 12:25:35
- monkeynotes
- Member
- From: UK
- Registered: 2005-04-13
- Posts: 41
Re: How do I link article image thumbnails directly to article images?
Thank you hakjoon, this seems to do the job, I really appreciate it. Also thanks to Mary.
Offline