Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-12-13 14:55:22
- drahera
- New Member
- Registered: 2011-12-13
- Posts: 4
How do i display/upload article specific images with smd_slimbox?
Hi all, I’m having some questions about the smd_slimbox plugin and how to make it work the way I want.
Each article within a certain section (using this gallery-article form I made) should have a gallery of it’s own. It should only show images related somehow to this specific article. Im sure it’s not a trouble for the plugin to pull these images out, but how would it work with the rest of textpattern?
Would I need the content managers to create a certain image category for each article they create? I’d like them to just upload images ‘to’ an article somehow, when they write the article.
I’m considering the category=“article-?id” thing, but can’t really make out how it works. Then I’m required to have a category named article-12 right? Thus creating that category for every article?
Offline
Re: How do i display/upload article specific images with smd_slimbox?
You can certainly achieve what you want by doing something along the lines you suggest in your question. However, you can create a more user friendly interface for the content managers which has a more natural association of images to an article using the plugin <txp:bot_image_upload />.
Offline
#3 2011-12-13 18:15:01
- drahera
- New Member
- Registered: 2011-12-13
- Posts: 4
Re: How do i display/upload article specific images with smd_slimbox?
Thanks Joe, that plugin will make the UI better and let me add the images using the write tab, but I will still need smd_slimbox to fetch the correct set of images, associating them with this article somehow right? The bot_image_upload will basically just make image upload possible from within the write tab, while writing the article – am I correct?
Offline
Re: How do i display/upload article specific images with smd_slimbox?
Although both plug-ins are still current, <txp:smd_slimbox />
was essentially replaced by Bloke (its author) by <txp:smd_gallery />
which is more capable. Down the line, as a TXP developer, he enhanced the TXP image tags in such a way that they could replace both plug-ins and more. As a result, you can upload multiple images (individually) as article images using <txp:bot_image_upload />
and call them as a gallery in the article form using the <txp:article_image />
tag. If it suits you better, you can use <txp:jbx_multiple_image_upload />
to have your users upload multiple images as a bunch at the same time as assigning them to an image category. Your user would then enter the image category in custom field you set aside for the purpose and call into the article form using <txp:images category="your_category" />
. Note that there are distinct <txp_image />
and <txp:images />
tags.
Here is a snippet from one of my sites that uses the ‘Category’ method. No TXP plug-ins required but did use the jQuery plug-in Fancybox. You can use this for any Gallery plug-in with a few minor changes to match the Gallery sysntax.
<txp:if_custom_field name="Fancybox Gallery Cat">
<txp:images category = '<txp:custom_field name="Fancybox Gallery Cat" />' sort="name" wraptag="ul" break="li" class="fbox-lineup"><a href="<txp:image_url />" class="fbox" title= "<txp:image_info/>" rel="gallery"><txp:thumbnail/></a></txp:images>
As always, there are doubtless other ways to achieve what you want. Have a nose around TXPTips.
Last edited by joebaich (2011-12-13 20:00:30)
Offline
#5 2011-12-13 21:09:39
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: How do i display/upload article specific images with smd_slimbox?
Hi,
in addition to to what Joe said, you can furtherly simplify your life using the <txp:images /> tag with the attribute ‘id’ in your article form this way:
<txp:images id='<txp:article_image />' />
By doing so you can ignore categories altogether. You can even display your images (in the public site) in the same sort order you specified in the write tab by following the code suggested here
Offline
#6 2011-12-13 22:28:43
- drahera
- New Member
- Registered: 2011-12-13
- Posts: 4
Re: How do i display/upload article specific images with smd_slimbox?
Thanks a lot, I did something in between I thin.
I added the nice <txp:bot_image_upload />
plugin so that I can add multiple article images, from the image bank. I then did a form something like this:
<txp:images auto_detect="article" break="">
<li class="cell">
<a rel="lightbox-smd" href="<txp:image_url />"><txp:thumbnail /></a>
</li>
</txp:images>
.. and I think this will be good enough. One enhancement would be to actually be able to upload the images in the write tab, but thats goldplating.
redbot, I did not get the <txp:images id='<txp:article_image />' />
to work at all, no images were showing. I was trying in the context of an article form.. thats correct?
Last edited by drahera (2011-12-13 22:34:51)
Offline
#7 2011-12-13 23:18:57
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,315
Re: How do i display/upload article specific images with smd_slimbox?
I’m rather sure redbot meant <txp:images id='<txp:custom_field name="article_image" />' />
.
drahera wrote:
One enhancement would be to actually be able to upload the images in the write tab, but thats goldplating.
bot_image_upload does exactly this. It removes the text input field for the article image and replaces it with a link to open the image tab in an iframe-lightbox thing.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
#8 2011-12-14 00:37:09
- drahera
- New Member
- Registered: 2011-12-13
- Posts: 4
Re: How do i display/upload article specific images with smd_slimbox?
uli, yeah your right. I was somehow assuming I was just accessing the image bank only, but fact is I can upload/manage all images through that iframe. I guess i’m too used to the way other CMS’s handles this, such as WP.
Since I’m using auto_detect="article"
I don’t really need <txp:images id='<txp:custom_field name="article_image" />' />
I guess. Default will give me the context of an article, and when I’m specifying auto_detect
I won’t get any images if the article doesn’t have any, right?
Offline
#9 2011-12-14 09:58:56
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: How do i display/upload article specific images with smd_slimbox?
uli wrote:
I’m rather sure redbot meant
<txp:images id='<txp:custom_field name="article_image" />' />
.
Oops!! Yes Uli is right, especially if you are inserting multiple imges, otherwise (for a single image) the code I posted should work.
drahera wrote:
Since I’m using auto_detect=“article” I don’t really need <txp:images id=’<txp:custom_field name=“article_image” />’ /> I guess
You are right but – once again – I don’t know if it works with multiple images. The fact is txp by default assumes there is only one article image hence the need to use <txp:images id='<txp:custom_field name="article_image" />' />
I guess i’m too used to the way other CMS’s handles this, such as WP
Eheh to tell the truth this plugin was indeed inspired from how wp handles images (using an iframe) when writing a post ;)
Offline
Re: How do i display/upload article specific images with smd_slimbox?
redbot wrote:
<txp:images id='<txp:custom_field name="article_image" />' />
. otherwise (for a single image) the code I posted should work.
Sadly not :-( Regardless of the number of images, <txp:article_image />
always returns a full anchor tag <a href="">...</a>
so it can’t be used a tag-in-tag unless you use the custom_field trick. Shame really. The article imag tag could do with an option to return just the raw field contents but I couldn’t figure out a useful (read: pretty / efficient / unambiguous) way to do it. Ideas welcome.
redbot wrote:
txp by default assumes there is only one article image
Sort of true. Since 4.3.0 <txp:article_image>
still only supports a single article image, but if you do list IDs in the article_image field and use <txp:images>
without altering auto_detect
then it’ll iterate over them all. <txp:article_image>
will still work, it’ll just ignore everything except the first one. And if you like bleeding edge code, a recent alteration to the core has been to use the image order you specify as the default image order.
drahera
joebaich is right. While smd_slimbox is handy, the built in core image tags can do way more as they’re based on things I learned while building smd_slimbox and then smd_gallery. You should only need smd_gallery now if you are doing some seriously advanced things, or you want to take advantage of hidden thumbnails or pagination of multiple galleries on a page, etc.
Last edited by Bloke (2011-12-14 10:34:40)
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
#11 2011-12-14 10:40:50
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: How do i display/upload article specific images with smd_slimbox?
Bloke wrote:
Sadly not :-( Regardless of the number of images,
<txp:article_image />
always returns a full anchor tag<a href="">...</a>
so it can’t be used a tag-in-tag unless you use the custom_field trick. Shame really. The article imag tag could do with an option to return just the raw field contents but I couldn’t figure out a useful (read: pretty / efficient / unambiguous) way to do it. …
You are absolutely right Bloke,
I need a vacation. I’m more retarded than usual theese days.
Offline