Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-05-19 07:49:57

pfctdayelise
Member
From: Melbourne, Australia
Registered: 2007-05-18
Posts: 68
Website

How can I just link to the article's image?

Hello,

I feel like this must be really obvious, but so far it’s still eluding me. I want to run a site similar to a photoblog.

I’m using image thumbnails as 500px width images, with the originals having dimensions like 1591×1234. So in the article I just put

<txp:article_image thumbnail="1"/>

but I want an easy way to link to the original file,so people can download it if they want. All the tags I’ve looked at just seem to display the image. What I would like is something like txp:article_image_ref or _id and then I can put that in a text link.

Or even if there was a way to make the thumnail link to the original. that would be cool too.

thanks,
Brianna

Offline

#2 2007-05-19 08:12:29

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: How can I just link to the article's image?

Use that in the article:

<txp:permlink><txp:article_image thumbnail=“1” /></txp:permlink>

and when single article is displayed use this(you can find the code in page tab):
<txp:if_article_list>
<txp:article />
<txp:else />
<txp:article form=“phform” />
</txp:if_article_list>

and create an article form call it “phform” and put this:

<txp:article_image />

The goal is when a single article is displayed it display only the full image size.

A+

Offline

#3 2007-05-19 08:43:45

pfctdayelise
Member
From: Melbourne, Australia
Registered: 2007-05-18
Posts: 68
Website

Re: How can I just link to the article's image?

thanks for the tip, but that’s not what I want…
there’s no use to display a 1500px-wide image on an article. I just want to be able to link directly to the jpg so the reader can right click on the link and download it.

Offline

#4 2007-05-19 09:34:57

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: How can I just link to the article's image?

wet_link allows you to link to an image, which results in many ways to link to a full size image:

  • A simple text link to the image: <txp:wet_link image="42">Click to view!</txp:wet_link>
  • A simple text link, plus a hook for LightBox: <txp:wet_link image="42" rel="lightbox">Click to view in a lightbox (if it is installed on this page)!</txp:wet_link>
  • A thumbnail link, plus a hook for LightBox: <txp:wet_link image="42" rel="lightbox"><txp:thumbnail id="42" /></txp:wet_link>

Last edited by wet (2007-05-19 09:35:52)

Offline

#5 2007-05-19 10:24:34

pfctdayelise
Member
From: Melbourne, Australia
Registered: 2007-05-18
Posts: 68
Website

Re: How can I just link to the article's image?

wet wrote:

wet_link allows you to link to an image, which results in many ways to link to a full size image:

Thanks, but unless there was article_image_link, that’s also not what I wanted. :) I figure if I can associate an image with every article, and it can automatically show that image, there surely must be a way to AUTOMATICALLY link to the image’s url…

I did find a way, but it’s a bit weird. I found upm_image has tags like <txp:upm_img_full_url />. perfect!

but when I tried putting that directly in my articles I got this error:
invalid context, tag must be used within the tag as a wrapper or from its own form called by the tag.

“tag must be used within the tag as a wrapper or from its own form called by the tag”… tag must be used within the tag… uhmmmm….

anyway I read through most of the forum thread for this plugin, and Mary’s comment #155 explained what I actually needed to do.

(I’m just explicating this in case someone else wants to do the same thing)

So now my set up is, when I write articles that go in the section ‘article’, they have a title and an ‘article image’ and a bunch of custom fields filled out pertaining to the image. the body of the article actually has no content.

then in my default form (type article), I have this:

<txp:tcm_if_article_image>
 <txp:upm_article_image form="image_post" />
</txp:tcm_if_article_image>

and in the image_post form (type misc) I created, I have this:

<txp:article_image thumbnail="1"/>
<p class="meta"><a href="<txp:upm_img_full_url />">Download original file</a> (<txp:upm_img_full_width />x<txp:upm_img_full_height />)</p>

(and some other stuff using the custom fields and tags).

now I feel very pleased. it is all neat and less work for me. :)

thanks for everyone’s help,
Brianna

Last edited by pfctdayelise (2007-05-19 10:28:09)

Offline

Board footer

Powered by FluxBB