Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-02-02 19:34:25
- mrjysta
- Member
- Registered: 2008-09-22
- Posts: 89
Complex image question (display an image if image category = 'x' )
I have been playing the hak_article_image and upm_image but have yet to find a solution with which to display an image thumbnail, (linking to an article page) that will take an image from the article list based on it’s category name. Does such a plug-in, method exist for doing this???
The reason I ask is I need a way of assigning a specific thumbnail for each article and each article has 3-10 images. Being a profile site it’s quite impotant that a specific thumbnail image is used. I’m alreading using the plug-in mentioned above and atb_image_pulldown. Because the articles are image intensive I will also be looking into an batch import plug-in for files and images. If anyone could recommends anything out there/?
Muchos Gracias Amigos/
Offline
#2 2009-02-02 19:45:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Complex image question (display an image if image category = 'x' )
mrjysta wrote:
take an image from the article list based on it’s category name.
Do you mean based on the image’s category name? And does it really have to be based on the image category, or have you thought about using a custom field for this?
Edit: sorry, didn’t read the subject very well ;)
Last edited by els (2009-02-02 19:46:25)
Offline
#3 2009-02-02 20:29:31
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Complex image question (display an image if image category = 'x' )
You might take a look at this ras_if_category_type it will take both the category type and category name as attributes.
Offline
#4 2009-02-02 20:50:21
- mrjysta
- Member
- Registered: 2008-09-22
- Posts: 89
Re: Complex image question (display an image if image category = 'x' )
Els wrote:
Do you mean based on the image’s category name?And does it really have to be based on the image category, or have you thought about using a custom field for this?
I’m already at my limit with custom fields :’-( otherwise that could be an option/
Offline
Re: Complex image question (display an image if image category = 'x' )
The reason I ask is I need a way of assigning a specific thumbnail for each article and each article has 3-10 images. Being a profile site it’s quite impotant that a specific thumbnail image is used.
I too am not sure if I quite understand you, but inferring from what you wrote here, does this mean that you are using an image-category to denote which image will be used as “the profile title image”? If so, I’ve solved this another way by placing the title image first in the article-image field and use hak_article_image with the attribute limit="1"
for the profile list page. If that image should not show on the actual profile itself (for example when it has a different size for the profile list page), use the attribute offset="1"
for the individual profile page. Maybe that is an alternative way of going about it?
TXP Builders – finely-crafted code, design and txp
Offline
#6 2009-02-02 22:31:15
- mrjysta
- Member
- Registered: 2008-09-22
- Posts: 89
Re: Complex image question (display an image if image category = 'x' )
jakob wrote:
does this mean that you are using an image-category to denote which image will be used as “the profile title image”?
Yes jakob, but with atb_image_pulldown I have no way of ensuring a specific order in the article image list. Thus ‘offset’ is not able to pick the correct image in each article. The reason I’m using atb_image_pulldown is so other users will be able to upload images and write articles. Therefore the articles image list can be assumed to be in a random order each time.
I have found smd_gallery which offers a display by category but it doesn’t seem to offer the nice thumbnail linking that you get in hak_
category : list of image categories to display. You may specify fixed-name categories (e.g. “animals”) or a question mark followed by an article field name. e.g. category=“animals, art-?id” would grab all images from category “animals” and category “art-42” (assuming the current article has an id of 42).
Offline
#7 2009-02-02 22:56:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Complex image question (display an image if image category = 'x' )
Maybe I’m over-estimating a certain plugin now (though I hardly believe that is possible), but wouldn’t smd_if be able to check if an image with category ‘x’ had an id that exists in the article image field?
Offline
Re: Complex image question (display an image if image category = 'x' )
mrjysta wrote:
I have found smd_gallery which offers a display by category but it doesn’t seem to offer the nice thumbnail linking that you get in hak_
Are you sure? You can build your thumbnail gallery how you want with a form in smd_gallery. If you explain a bit more about what you mean by this (I’ve never used hak_ sorry) then I might be able to advise you on an equivalent.
If you want to isolate a single image, you might get somewhere with the smd_if plugin which you can embed in smd_gallery like this:
<txp:smd_gallery category="?article_image">
<txp:smd_if field="{category}" operator="eq" value="my_printy_thumbnail_category">
<a href="<txp:permlink />"><txp:thumbnail id="{id}" /></a>
</txp:smd_if>
</txp:smd_gallery>
(untested, off the top of my head)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#9 2009-02-02 23:46:43
- mrjysta
- Member
- Registered: 2008-09-22
- Posts: 89
Re: Complex image question (display an image if image category = 'x' )
Ah, i’ll look into downloadng smd_if !!!
To paint a bit of a picture, I hope this makes sense:
The section hompages contains a 5col grid of upto 50 thumbnail images, each linking to their article pages. Each article is a profile that holds 5-10 images on a particular member (+ some custom fields and body text etc..). (all been dealt with using Jquery cycle + hak/) this side of things all works great.
now:
What needs to be ensured is that the thumbnail being displayed on the homepage is the members prefered image, rather then the first image in the articles_image list.
Each articles thumbnail on the homepage would be assigned the “profile” category in the images tab. This would ensure the correct image of the 5-10 images is displayed on the homepage for that particular article.
Using the category means we can be specific across all articles regardless/
This in principle doesn’t seem like it would be too difficult to achieve, <txp:article_image_category /> tag maybe ?????
I’ll have another look at the help on smd_gallery and also smd_if in the morning/
Offline
#10 2009-02-06 00:21:17
- mrjysta
- Member
- Registered: 2008-09-22
- Posts: 89
Re: Complex image question (display an image if image category = 'x' )
Hi guys, please don’t give up on me just yet ;-P
This is what I had setup with Hak. Created a thumbnail link for each article in a 4 column grid on the main page. Each image was inside a Div with the Alt text displayed underneath the thumbnail. Only problem with this is I can’t specify a particular thumbnail I want using the image category.
In main page:
<txp:article limit“50” form=“main_thumbs” />
main_thumbs:
<div class=“pfilebox”><txp:hak_article_image form=“alt_form” limit=“1”/></div>
alt_form:
<txp:hak_article_image_link type=“page”><txp:hak_thumbnail class=“pfilepic” /><txp:hak_image_alt wraptag=“h3” class=“indent” /></txp:hak_article_image_link>
Had A look into smd_gallery. Your example seemed to make sense Bloke. So I amened the code slightly and re-referenced the form in my main page:
In main page:
<txp:article limit“50” form=“smd_thumbs” />
smd_thumbs
<txp:smd_gallery category=”?article_image”>
<txp:smd_if field=”{category}” operator=“eq” value=“Profile”>
<div class=“pfilebox”><a href=”<txp:permlink />”><txp:thumbnail id=”{id}” class=“pfilepic” /></a></div>
</txp:smd_if>
</txp:smd_gallery>
Only problem is I get nothing on the page :-/
Am I calling the form in the wrong way and also is there a way in smd to display the images alt text like I have done in hak/
Offline
Re: Complex image question (display an image if image category = 'x' )
Is this code copies as-isfrom your template?
In main page:
<txp:article limit“50” form=“main_thumbs” />
You have missed =
after limit
. And switch site work mode to Debug
or Test
– if messages occure – they can help to find error
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Complex image question (display an image if image category = 'x' )
mrjysta wrote:
Yes jakob, but with atb_image_pulldown I have no way of ensuring a specific order in the article image list.
Just for future reference, jmd_img_selector doesn’t sort article-images, so the order you select the images in is the order used by the article-image field.
Last edited by jm (2009-02-06 01:10:28)
Offline