Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_thumbnail: manage multiple thumbnails of your images
Mmm. First real effort at using this fantastic plugin and getting an error message:
Tag error: <txp:smd_thumbnail type="large" /> -> Textpattern Notice: Unknown image. on line 1038
Profile name is “large”, the profile is active and there is another profile which is default. Even without the type attribute no thumbnails display and the error message persists. Mmm!
Edit: 4.3 install.
Last edited by jstubbs (2010-12-25 10:55:52)
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
OK solved it – the code needed the new txp:images></txp:images tag to retrieve the article image thumbnail:
<txp:images break=""><txp:smd_thumbnail type="large" /></txp:images>
Interestingly, before installing smd_thumbnail, just using <txp:thumbnail /> worked fine even with 3 images in the article image field (that in itself is a great addition to 4.3!) – TXP worked as expected by displaying the first article image in the field.
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
Somewhat tangential to my post above, on the entry for <txp:images /> on TextBook – the attribute auto_detect="" is a little unclear.
If you wish to turn off the automatic check, set this to auto_detect=”“….
Then later, it says something which appears to contradict that:
<txp:images auto_detect=”“ /> displays all images in the database.
I am using smd_thumbnail to display thumbnails entered in an article image field. Normally, this field might contain several images id’s, but in case there is nothing entered in the field so nothing should be displayed.
Using the following code (with nothing at all in the article image field), what I see is all images inside the database – did I miss an attribute setting?
<txp:images break="">
<li><a class="thumb" name="<txp:image_info type="name" />" href="<txp:image_url />" title="<txp:image_info type="name" />"><img src="<txp:image_url thumbnail="1" />" alt="<txp:image_info type="alt" />" /></a>
<div class="caption">
<div class="image-desc"><txp:image_info type="caption" /></div>
</div>
</li>
</txp:images>
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
jstubbs wrote:
auto_detect=""is a little unclear.
OK, I can fix the documentation — it’s still WIP. Though it is true: the default is auto_detect="article, category, author" which will automatically check if there is a) something in the ‘article image’, b) a category list page in effect, c) an author list page in effect. So if you shut this off with auto_detect="" then it won’t look in those places.
Against my better judgement, but to fit in with all the other tags, the default operation is to display all items if nothing is detected (or other filter attributes are used, such as category, id, author, realname, etc). Since the act of shutting off auto_detect means the tag won’t even bother being clever and looking for anything, it has the net effect of returning all images. Not my first choice of behaviour, but it’s what the linklist and file_download_list tags do (erroneously, imho). I feel tags should, by and large, be opt-in rather than opt-out.
…in case there is nothing entered in the field so nothing should be displayed.
Yes, you’re hitting the same issue as above. I dont like it much, but that’s where <txp:smd_if_thumbnail /> comes into play.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
Tags should definitely be opt-in – that’s good behaviour IMO.
Looks like <txp:smd_if_thumbnail /> needs to be used in a form – I get an error using this on a page:
<txp:article limit="100">
<txp:if_individual_article>
<txp:output_form form="portfolio_gallery" />
<txp:else />
<div class="portfolio">
<txp:permlink class="portfolio_item">
<txp:smd_if_thumbnail>
<txp:images break=""><txp:smd_thumbnail type="large" /></txp:images>
</txp:smd_if_thumbnail>
</txp:permlink>
<txp:excerpt />
</div>
</txp:if_individual_article>
</txp:article>
Error message:
Tag error: <txp:smd_if_thumbnail> -> Textpattern Notice: Image tags cannot be used outside an image context on line 2312
Am I right?
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
OK well that’s not the cause of the error because I use the following code on another page and see all of the images in the database – and there is no image attached to the article in question, same as the other page.
The error message does display though – in debugging at least.
<txp:article limit="1">
<h2><txp:title /></h2>
<txp:body />
<txp:smd_if_thumbnail>
<txp:images break=""><txp:smd_thumbnail type="large" /></txp:images>
</txp:smd_if_thumbnail>
</txp:article>
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
jstubbs
Try this (untested) with the smd_if_thumbnail inside the images tag:
<txp:article limit="1">
<h2><txp:title /></h2>
<txp:body />
<txp:if_article_image>
<txp:images break="">
<txp:smd_if_thumbnail>
<txp:smd_thumbnail type="large" />
</txp:smd_if_thumbnail>
</txp:images>
</txp:if_article_image>
</txp:article>
EDIT: to add if_article_image
Last edited by Bloke (2010-12-25 15:18:38)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
Thanks Stef. Interesting result – one code block brings an error but the other one does not, although in both cases there is no article image assigned.
In debug mode, this works in one section/page template without any error:
<txp:article limit="1">
<h2><txp:title /></h2>
<txp:body />
<txp:if_article_image>
<txp:images break="">
<txp:smd_if_thumbnail>
<txp:smd_thumbnail type="large" />
</txp:smd_if_thumbnail>
</txp:images>
</txp:if_article_image>
</txp:article>
In the other section/page template (this is an article list, but I am testing the first article in the list which has no article image assigned), this code block also works but the error message displays:
<txp:article limit="100">
<txp:if_individual_article>
<txp:output_form form="portfolio_gallery" />
<txp:else />
<div class="portfolio">
<txp:permlink class="portfolio_item">
<txp:if_article_image>
<txp:smd_if_thumbnail type="large">
<txp:images break=""><txp:smd_thumbnail type="large" /></txp:images>
</txp:smd_if_thumbnail>
</txp:if_article_image>
</txp:permlink>
<txp:excerpt />
</div>
</txp:if_individual_article>
</txp:article>
Error message is displayed 11 times – Tag error: <txp:smd_if_thumbnail type="large"> -> Textpattern Notice: Image tags cannot be used outside an image context on line 2312 – and there are 12 articles, so I guess the first article which has no image is not causing an error (on the list view page).
On the individual article page, using <txp:if_article_image> as a wrapper tag as in the above example does work correctly – it no longer retrieves all the images in the DB. Thanks for the tip!
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
Someone already mentioned that smd_thumbnail works with smd_gallery but i can’t get even simple form to work, why?
Here is what i have on page…
<txp:smd_gallery category="<txp:custom_field name="Galerija" />" limit="500"><txp:smd_thumbnail link_rel="prettyPhoto" link="1" /></txp:smd_gallery>
…and i get tihs error… <txp:smd_thumbnail link_rel="prettyPhoto" link="1" /> -> Textpattern Notice: Unknown image. on line 1038
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
debeljko
You normally get an unknown image error if you have no thumbnail assigned to an image. I am going to make some assumptions:
1) You have added at least one smd_thumbnail profile
2) You have set one of the profiles as default
3) While smd_thumbnailhas been active you have uploaded images to the category listed in the ‘Galerija’ custom field, or you have clicked ‘Create all’ from the smd_thumbnail control panel
Assuming all the above have been satisfied, you should try to either alter the quotes around the category attribute so the TXP parser is told that you have a tag nested inside:
<txp:smd_gallery category='<txp:custom_field name="Galerija" />' limit="500"><txp:smd_thumbnail link_rel="prettyPhoto" link="1" /></txp:smd_gallery>
OR, you use the smd_gallery shorthand:
<txp:smd_gallery category="?galerija" limit="500"><txp:smd_thumbnail link_rel="prettyPhoto" link="1" /></txp:smd_gallery>
Both of those should work the same way (notice I’ve used lower case ‘galerija’ — that’s the usual way to do it, but it may need to be defined with the capital G. Try it and see. Usually, TXP converts the names to lower case (internally) when you set the custom field up).
jstubbs
You need to alter the order of the <txp:smd_if_thumbnail> and <txp:images> tags again — the test for a thumbnail needs to occur inside the images tag — otherwise it just shrugs its shoulders and goes “huh? what images?” and warns you. This should work:
<txp:article limit="100">
<txp:if_individual_article>
<txp:output_form form="portfolio_gallery" />
<txp:else />
<div class="portfolio">
<txp:permlink class="portfolio_item">
<txp:if_article_image>
<txp:images break="">
<txp:smd_if_thumbnail type="large">
<txp:smd_thumbnail type="large" />
</txp:smd_if_thumbnail>
</txp:images>
</txp:if_article_image>
</txp:permlink>
<txp:excerpt />
</div>
</txp:if_individual_article>
</txp:article>
Last edited by Bloke (2010-12-27 12:54:16)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
Hi Stef, just tried your code in debugging and testing mode and the error message disappeared as you said it would. Yay! Thanks!
Offline
#87 2011-01-05 17:46:05
- des
- New Member
- Registered: 2011-01-05
- Posts: 3
Re: smd_thumbnail: manage multiple thumbnails of your images
Is there way to use this plugin with the lam_image_uploader plugin? I like uploading my images through the write tab as I’m typing, but the thumbnail sizes I need aren’t being created when I upload that way now.
Offline
#88 2011-01-12 12:18:10
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: smd_thumbnail: manage multiple thumbnails of your images
Hello Steff,
have you some plan to address this thumbnail creation problem … soon ?
Each time I upload 30, 40 , 50 new images, I must rebuild 200, 230, 270, 320 thumbnails x nbr of profiles :-(((
Thanks !
Last edited by jpdupont (2011-01-12 13:25:44)
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
jpdupont wrote:
have you some plan to address this thumbnail creation problem
Planned: yes
Implemented: partially
I have converted the ‘Create all’ button to ‘Create’ and added a select list nearby with the following options:
- All
- With selected
- By category
- By author
Currently, ‘all’ and ‘with selected’ work, so you can use the built-in checkboxes (and all/none/range) to choose the images you want to affect and then apply the thumbnails only to that subset of images. Next job is to do the category and author selects. Then I have to implement the global setting that maniqui asked for and we’re good for the next release.
I’ll try and have a working version out next week. Poke me if it doesn’t appear.
Last edited by Bloke (2011-01-12 13:11:55)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_thumbnail: manage multiple thumbnails of your images
des wrote:
Is there way to use this plugin with the lam_image_uploader plugin
Sadly no. This plugin only currently works on the Images tab. I don’t know if the two can be integrated (and don’t have a copy of lam_image_uploader to look at the code — the download doesn’t work any more). If someone could send me the plugin I can take a peek, but no promises.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline