You are not logged in.
Great plugin !
Just one request and it will be the perfect one fo me :
We can choose Height or Width (or both), but it’s hard to manage vertical /horizontal images if we don’t want them to turn square…
A third choice Greater size would be welcome. So that we could define a single style that would set the height of a vertical image OR the with of a horizontal one.
Don’t know if that makes sense…
Last edited by Niconemo (2010-12-15 13:53:48)
Nico
Offline
Niconemo wrote:
We can choose Height or Width (or both), but it’s hard to manage vertical /horizontal images if we don’t want them to turn square… A third choice Greater size would be welcome
Glad you like the plugin. So you want a profile that somehow figures out the aspect ratio of the image and adjusts itself accordingly? Sorry, probably not going to happen as the underlying (TXP core) function needs to store the physical dimensions and the plugin can’t rewrite profiles on the fly.
As an alternative, have you considered this bit of trickery:
Wide and one called TallWide profile’s height and leave its width 0 so it auto-scales the width in proportionTall profile’s width and leave its height 0 so it auto-scales the height in proportionFor example:
<txp:images category="some_cat">
<txp:smd_if field='<txp:image_info type="w" />' operator="gt" value='<txp:image_info type="h" />'>
<txp:smd_thumbnail type="Wide" />
<txp:else />
<txp:smd_thumbnail type="Tall" />
</txp:smd_if>
</txp:images>
How’s that for a workaround? You’ll waste a bit of disk space storing two thumbs for each image when you really only want one, but you can decide if that’s an acceptable trade-off.
Last edited by Bloke (2010-12-15 14:35:14)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
Sorry, probably not going to happen as the underlying (TXP core) function needs to store the physical dimensions and the plugin can’t rewrite profiles on the fly.
OK. I was prepared to your answer. Here is the solution I found (with some smd_if too, of course) to avoid the use of the image_info :
<txp:variable name="hauteur-image" value='<txp:upm_article_image><txp:upm_img_full_height /></txp:upm_article_image>' /> <txp:variable name="largeur-image" value='<txp:upm_article_image><txp:upm_img_full_width /></txp:upm_article_image>' /><txp:smd_if field="txpvar:largeur-image" operator="gt:NUM" value='<txp:variable name="hauteur-image" />'> <txp:smd_thumbnail type="Wide" /> <txp:else /> <txp:smd_thumbnail type="Tall" /> </txp:smd_if>
Thank you again !
Last edited by Niconemo (2010-12-16 10:20:13)
Nico
Offline
Niconemo wrote:
to avoid the use of the image_info
Out of curiosity, why avoid it? Does it not do what you want? If you take the category attribute out of the <txp:images> tag in the code I posted then I think it does exactly the same as your code (because <txp:images> automatically reads the article image if you use no attributes), and it’s shorter.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
Well…
I think your’re right. In fact I read your code much too fast. I must admit, I discover the txp:image_info tag (Genealogy : Version 4.3.0 – tag introduced) and I was thinking about something completely different (some custom field or something…).
Your proposition is far better !
Nico
Offline
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)
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline
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.
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline
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>
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline
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.
Txp Builders – finely-crafted code, design and Txp
Offline
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?
TXP Tips | @txptips | Me | @jonathanstubbs | Github
TXP Builders – finely-crafted code, design and txp @txpbuilders
Offline