Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pulling out the image id from an article
How can I capture an article’s image id in a form?
Because I would like to implement the nifty zoom thing from here, I need to create the code:
<a href="http://www.mysite.com/images/ID.jpg" />
<txp:article_image /> won’t do because it will create
<img src="http://www.mysite.com/images/ID.jpg" />
Any ideas?
Offline
#2 2010-03-06 21:22:54
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Pulling out the image id from an article
I think it was this here: <txp:php>echo $thisarticle['article_image'];</txp:php>
Edit Try and test with FF v3.0.n. I remember having unsatisfactory experiences opening images, not every picture would zoom in this demo there.
Last edited by uli (2010-03-06 21:34:19)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: Pulling out the image id from an article
Thank you for this, uli. That works.
Although I hate dipping into PHP with TXP, rather than use a tag. It always feels like cheating to me.
Offline
#4 2010-03-06 21:36:29
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: Pulling out the image id from an article
amordecosmos wrote:
It always feels like cheating to me.
:)) I think developers might see it the other way round or see using tags like operating knives and forks with chopsticks or so. LOL
Please notice my caveat I added above.
Last edited by uli (2010-03-06 22:01:47)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#5 2010-03-06 22:29:39
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Pulling out the image id from an article
amordecosmos wrote:
Although I hate dipping into PHP with TXP, rather than use a tag. It always feels like cheating to me.
If you prefer using a plugin over PHP, upm_image can get the image id (and much more).
Offline
Re: Pulling out the image id from an article
Or if you like living on the edge you can install the latest development release, which has a host of new image-related tags.
Code is topiary
Offline
Re: Pulling out the image id from an article
Thank you, Els. upm_image is one of my ‘must-installs’ for every new site, but I did not know it could pull the id.
Jsoo, I need this for a live site so nix to the development release, but I’m very excited about the next version and its new tags.
Offline