Textpattern Forum

You are not logged in. Register | Login | Help

#1 2005-08-24 02:24:45

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

hak_article_image

<txp:hak_article_image /> is an enhancement to <txp:article_image /> it supports multiple images per article along with various ways of attaching links to the images. The article image field should contain one or more numeric image IDs separated by commas.

<txp:hak_article_thumb /> displays the image thumbnail(s) with an options to link the thumbnail in various different ways.

Current Version:

0.6.2

Attributes:

  • *limit*=‘x’ : Show only x number of images. Default is all images in the article image field.
  • *offset*=‘x’ : offset the first image shown by x images.
  • *link*=‘1’ : links the image in manner determined by linktype.
  • *linktype*=‘type’ : type of link to create. Options:
    • image : link to the full size image.
    • page : link to the current page passing the image id in a way that can be used by <txp:image_display /> or <txp:hak_article_image urloverride="1" />.
    • section : link to a specific section defined in the section attribute passing the image id in a way that can be used by <txp:image_display /> or <txp:hak_article_image urloverride="1" />.
    • category : link to the image’s category page or to a specific category defined in the category attribute passing the image id in a way that can be used by <txp:image_display /> or <txp:hak_article_image urloverride="1" />.
    • section-category : link to a specific section defined in the section attribute and to the image’s category page or a specific category defined in the category attribute passing the image id in a way that can be used by <txp:image_display /> or <txp:hak_article_image urloverride="1" />.
  • *section*=‘section name’ : section to link to when using linktype=‘section’ or linktype=‘section-category’ .
  • *category*=‘category name’ : category to link to when using linktype=‘category’ or linktype=‘section-category’ .
  • *anchor*=‘anchor name’ : pass an anchor along with the link. Not available when using linktype=‘image’ because there would be no point.
  • *popup*=1 : makes the link open in a popup window. Only available when using link.
  • _*popwidth*_=‘integer’ : increase the popup window width by this much.
  • _*popheight*_=‘integer’ : increase the popup window height by this much.
  • *urloverride*_=‘1’ : will override the image displayed with the image passed in the url by <txp:image_index /> or <txp:hak_article_image displaylink="1" />. Would normally be used along with _limit=‘1’
  • *urlhide*_=‘1’ : will not display the image if it matches the image being passed in with the url, by using _linktype=‘section or page’ or <txp:image_index />
  • *rel*=‘attribute’ : passes a rel attribute to a link created by link=‘1’ useful for lightbox/thickbox fun.
  • *class*=‘classname’ : passes a class attribute to a link created by link=‘1’ .
  • *linktitle*=‘attribute’ : passes a title attribute to a link created by link=‘1’ also useful for lightbox/thickbox fun. Can accept any text or two special keywords:
    • txp:caption : inserts the image’s caption.
    • txp:alt : inserts the image’s alt information.
  • *form*=‘form name’ : allows you to use a form to control the image output. See below.
  • Both tags support the standard break, wraptag, class and breakclass attributes.

Using forms

<txp:hak_article_image /> also supports using forms to format how your article images are displayed. Forms also give you access to the image’s caption information. All the same attributes are available but they are distributed among different tags.

<txp:hak_article_image /> and <txp:hak_article_thumb /> control which images will be used. It takes the following attributes:

  • limit
  • offset
  • urloverride
  • urlhide
  • The standard break , wraptag , class and breakclass attributes.

Form Tags

<txp:hak_article_image_link /> creates a link with various options. Should be used as a container tag with an opening and closing tag. It takes the following attribues:

  • type same as linktype
  • section
  • category
  • anchor
  • popup
  • popwidth and popheight
  • rel
  • title same as linktitle
  • class same as linkclass

<txp:hak_image /> and <txp:hak_thumbnail /> displays either the full size image or the thumbnail. Accept a class attribute.

<txp:hak_image_caption /> displays the caption for the current image. Accepts the standard break, wraptag, class and breakclass attributes.

<txp:hak_image_alt /> displays the alt information for the current image. Accepts the standard break, wraptag, class and breakclass attributes.

Deprecated options

These will still work but you should use the new options as they are more flexible

  • poplink – same as:
    • <txp:hak_article_image link="1" linktype="image" popup="1" />
  • displaylink – same as:
    • <txp:hak_article_image link="1" linktype="page" />

Download

Download hak_article_image

Last edited by hakjoon (2007-04-23 01:16:53)


Shoving is the answer – pusher robot

Offline

#2 2005-08-24 05:44:55

cpk
Member
Registered: 2005-08-07
Posts: 62

Re: hak_article_image

Nice job Patrick!

Thanks again!

cpk

Offline

#3 2005-08-25 06:28:55

Sandwich
Member
Registered: 2005-02-14
Posts: 37

Re: hak_article_image

It doesn’t seem to pick up on having TXP in a subdirectory. I have TXP running under www.somedomain.com/txp/, but it’s referring to the article images as being located in /images/. Looks like you need to tack on the TextPattern install directory in front of that.

I guess that’s an adjustment the zem_article_image code would need too.

Last edited by Sandwich (2005-08-25 06:29:37)

Offline

#4 2005-08-25 12:27:41

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

Re: hak_article_image

The main part of this code is pretty old (1.19 gamma). I’m in the process of modifying it to use some of the new globals instead of the old ones. Hopefully that should fix problems like this.

Last edited by hakjoon (2005-08-25 12:27:52)


Shoving is the answer – pusher robot

Offline

#5 2005-08-26 23:39:23

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

Re: hak_article_image

Version 0.2.2

I updated the code to use the new globals for site root. This should hopefully make it work properly in subdirectories. I have tested it working with messy urls but I don’t a subdirectory install with clean urls working right now. If someone could let me know if it works.


Shoving is the answer – pusher robot

Offline

#6 2005-09-01 02:15:22

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

Re: hak_article_image

I updated hak_article_image to version 0.3. This version adds the ability to create a link from the thumbnail to the same page passing the image id (displaylink=“1”). This id can be picked up by <txp:image_display /> or <txp:hak_article_image urloverride="1" />.

Version 0.3


Shoving is the answer – pusher robot

Offline

#7 2005-09-01 03:55:29

rajo
Member
Registered: 2004-03-13
Posts: 43

Re: hak_article_image

awesome, thank you so much for adding this functionality.

Offline

#8 2005-09-03 22:51:30

rajo
Member
Registered: 2004-03-13
Posts: 43

Re: hak_article_image

oops, finally tried it out and it still generates a popup when I set the displaylink attribute in hak_article_thumb using the latest revision of txp.

Offline

#9 2005-09-04 21:01:10

hakjoon
Moderator
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,631
Website

Re: hak_article_image

Are you using 0.3.1 ? I had some logic issues in 0.3 that could be causing what you are seeing. 0.3.1 is working as expected for me.


Shoving is the answer – pusher robot

Offline

#10 2005-09-05 00:40:40

rajo
Member
Registered: 2004-03-13
Posts: 43

Re: hak_article_image

yes, I am using 0.3.1. so far on safari and firefox it is not working properly, there could be a chance I am not using the tags correctly. should they both be in article forms?

Offline

Board footer

Powered by FluxBB