Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 23:41:18

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,269
Website Mastodon

Article Image

I have the following code in my port_list form:

<txp:custom_field name="portfolio_filter" escape="" />
	<txp:article_image wraptag="p" class="img-fluid" alt=""/>
	  <div class="portfolio-info">
		<h4><txp:title /></h4>
		<p><strong>Role: </strong> <txp:excerpt /></p>  
  <a href="./images/2.png" title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><i class="bi bi-zoom-in"></i></a>  

every thing is working as expected but I cannot manage to add Txp tag code to replace the string ./images/2.png
I have tried various combo Txp tags but either the href link is malformed or it fails to correctly display the image.

I was thinking of using a custom form and manually type in the “./images/##.png” so that can I use <a href=”<txp:custom_field name=“image _link/>” title=”<txp:title />” etc. But perhaps there is a simpler option.

PS: The article image is always the same id as what I wish to add to the href area. i.e. image id 2 in this example and is displayed in a larger format when link is clicked (I don’t create thumbnails).

Last edited by bici (Today 00:16:18)


…. texted postive

Offline

#2 Today 00:13:34

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,269
Website Mastodon

Re: Article Image

UPDATE.
I am trying out using a custom form as it seems like a good easy solution.
But I wonder why I am getting the actual string output as well as the directory is correctly output:

<a href=”<txp:custom_field name=“image _link/>” title=”<txp:title />”

in my custom field I have ./images/2.png

and the url / link is correctly rendered and I can click on the image link and it renders the image. But i also get the string ./images/2.png rendered on the page? How can I avoid that from happening?

this is the output

./images/2.png
<a href="./images/2.png" title="Sample Logo" data-gallery="portfolio-gallery-app" class="glightbox preview-link">

Last edited by bici (Today 00:17:56)


…. texted postive

Offline

#3 Today 01:53:36

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

Re: Article Image

Hi bici,

I guess you are would like to add a lightbox to your site. Your list form appears to be incomplete as there are no closing tags for custom_field and article_image tags.
You can try

<txp:hide>add one or more comma separated ids in your article image</txp:hide>
<txp:variable name="image" value='<txp:custom_field name="article_image" />' />
<txp:images id='<txp:variable name="image" />'><a href=">/images/<txp:image_info type="id" /><txp:image_info type="ext" />title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><txp:thumbnail />' /></a></txp:images> 

if you actually wish to use the lightbox I linked abobe use

<txp:hide>add one or more comma separated ids in your article image</txp:hide>
<txp:variable name="image" value='<txp:custom_field name="article_image" />' />
<ul class="box-container three-col">
<txp:images id='<txp:variable name="image" />'><li class="box"><div class="inner"><a href=">/images/<txp:image_info type="id" /><txp:image_info type="ext" />title="<txp:title />" data-gallery="portfolio-gallery-app" class="glightbox preview-link"><txp:thumbnail /></a></div></li></txp:images>
</ul>

Edited to add that instead of <txp:title /> I would use <txp:image_info type="alt" /> as it will provide the images their own distinct alt tags.

Last edited by colak (Today 03:27:06)


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

Offline

Board footer

Powered by FluxBB