Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#136 2011-02-28 22:40:03
Re: Images are 1st class citizens of TXP
Thanks Stef – I see now, I was actually over complicating things with my forms, duplicating items unnecessarily.
It was actually much more simpler – I now have this:
<txp:images form="slir-120" />
and this
<img src="<txp:image_url />" thumbnail="1" alt="<txp:image_info type="alt" />" />
Works great – I was just thinking it must be harder :)
Offline
#137 2011-02-28 23:15:44
Re: Images are 1st class citizens of TXP
thumbnail="1" wouldn’t be doing anything there since it’s in a HTML tag and not a TXP tag. I think you want
<img src="<txp:image_url thumbnail='1' />" alt="<txp:image_info type="alt" />" />
Last edited by MattD (2011-02-28 23:18:20)
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
#138 2011-03-01 00:28:25
Re: Images are 1st class citizens of TXP
Thanks MattD – that was my copying error :)
Offline
#139 2011-03-18 13:45:59
Re: Images are 1st class citizens of TXP
OK – got another one here – it could be because I am tired at the moment – but basically the first txp:images tag should only show one image from the article_image field in order, the second should show the the other images, offsetting the first – but it isn’t working unless I add a limit=“any number” – not sure if this is a bug, or the way it should work, or even if it is worth mentioning :):
<txp:images form="comp-gallery" wraptag="ol" break="li" class="adopted-gallery" limit="1" sort='FIELD(ID,<txp:custom_field name="article_image" />)' />
<txp:images form="adopted-gallery" wraptag="ol" break="li" class="adopted-gallery" offset="1" sort='FIELD(ID,<txp:custom_field name="article_image" />)' />
Offline
#140 2011-03-18 14:10:48
Re: Images are 1st class citizens of TXP
That’s the way it is expected to work. Set a limit in order to have an offset.
Offline
#141 2011-03-18 15:10:17
Re: Images are 1st class citizens of TXP
Bloke – Think Gallery.
Album -> Thumbnails -> Commenting on full-size images.
This is your task. Go forth, produce.
Offline
#142 2011-03-21 01:14:45
Re: Images are 1st class citizens of TXP
johnstephens wrote:
That’s the way it is expected to work. Set a limit in order to have an offset.
Really – thanks :) Another thing I’ve never come across :)
Offline
#143 2011-03-21 02:00:42
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: Images are 1st class citizens of TXP
Hey Bloke
I am trying to simplify my images using the new tag and resizing capabilities of 4.3 but have come across a stumble trying to get Article Image to match my easiest workflow.
I have uniquely named (9780889226548.jpg) images based on ISBN 13 (Book ISBN’s). So to make my life easier I directly linked them to a custom field call in the article image field. I tell the user to drop the jpg in the image folder and everything works.
Article Image Field=[../images/<txp:custom_field name=“ISBN-13” />.jpg]
The problem with this is that I can’t use the image tag because these images don’t go through the image upload, no ID, no NAME, if only there was a URL attribute of the image tag.
<txp:image url=”../images/<txp:custom_field name=“ISBN-13” />.jpg” /> then I could take advantage of on the fly resizing. But no go.
So ok I will use the image uploader. This would work out great if I could custom choose the ID of the image and make it match my custom ISBN-13. I know the name will match the ISBN-13 but the article image field only accepts ID, or URL’s as valid code.
Article Image=[<txp:custom_field name=“ISBN-13” />.jpg] but no go unless you no of an easy way for Image ID to match the Image NAME.
Because I deal with hundreds of books and articles at a time, this is a problem for me and not for most.
So this may be a feature request:
Can the Article Image Field reference Image NAME as well as ID and URL or can the Image tag have an URL attribute?
Cheers
L
Offline
#144 2011-03-21 11:09:07
Re: Images are 1st class citizens of TXP
lazlo wrote:
Can the Article Image Field reference Image NAME?
Yes. Sort of. If you only ever have one ISBN per article, and one image per article (discount smd_thumbnail: that could still access multiple thumbs from a single entity in a single field) then you can approach it in one of two ways. They’re both identical really, it just depends on your workflow.
With the ISBN in a custom field, try this:
<txp:images name='<txp:custom_field name="ISBN-13" />.jpg'>
<txp:thumbnail />
</txp:images>
The <txp:images /> tag builds you a “gallery” of one image based on the name in the custom field. It would do the same thing if you had a comma-separated list of image names but that would mean you would have to add the .jpg to each value in the ISBN-13 field (yuk) or do some cunning stuff to iterate over each value in there, add .jpg to the end of each, maybe stash the result in a txp:variable to save your sanity and then squirt that into txp:images. Not impossible, just more involved and probably relying on a plugin like rah_repeat.
The other approach is the same gravy but using the article image field to hold the image name and using this custom_field trick:
<txp:images name='<txp:custom_field name="article_image" />.jpg'>
<txp:thumbnail />
</txp:images>
In both cases you can put any image / thumbnail / image_info / image_url / image_author / plugin tag (e.g. smd_thumbnail) in the container to perform your nefarious image-related bidding.
Hope that helps.
Last edited by Bloke (2011-03-21 11:10:51)
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
Online
#145 2011-03-21 20:29:26
- lazlo
- Member
- Registered: 2004-02-24
- Posts: 110
Re: Images are 1st class citizens of TXP
Thanks Bloke
This may be the answer I was looking for, I am not sure. Clarification is needed.
If I don’t use the image uploader there is no image ID to refer to, but are you saying that if I already know the name I can refer to it without using the image uploader.
Does textpattern use image NAME to directly reference the IMAGES folder and therefore doesn’t care if there is a NAME table in the database?
<txp:images name=’<txp:custom_field name=“ISBN-13” />.jpg’>
<txp:thumbnail />
</txp:images>
Is this saying look in the IMAGES folder for ‘<txp:custom_field name=“ISBN-13” />.jpg’ not look in the image table for ‘<txp:custom_field name=“ISBN-13” />.jpg’ and refer to url from there?
If this is the case I can work with that like crazy.
I am I understanding this correctly?
L
Last edited by lazlo (2011-03-21 20:30:20)
Offline
#146 2011-03-21 21:16:21
Re: Images are 1st class citizens of TXP
lazlo wrote:
If I don’t use the image uploader there is no image ID to refer to, but are you saying that if I already know the name I can refer to it without using the image uploader.
Ah, errr no. I was going on the 2nd of your premises whereby you said:
So ok I will use the image uploader.
The txp:images tag can only work on what it knows is in the database. If you’re bypassing TXP then I’m afraid you’re stuck with doing things manually: and that includes resizing.
Sorry if I got your hopes up unnecessarily.
Last edited by Bloke (2011-03-21 21:16:54)
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
Online
#147 2012-02-13 16:59:59
Re: Images are 1st class citizens of TXP
Can someone – more technical than myself – please add container examples of <txp:images></txp:images> to the CMS documentation on this page?
Example 2 is where I’m guessing it goes but the page has not been completed properly.
Offline
#148 2012-02-13 18:50:31
Re: Images are 1st class citizens of TXP
Phil, just added an example that was hiding out on the image_info page, and one of my own that shows how to use a script like timthumb.php. Not sure if that’s kosher for wiki docs, but it’s sure been helpful.
Last edited by maruchan (2012-02-13 18:52:19)
Offline
#149 2012-02-13 19:14:59
Re: Images are 1st class citizens of TXP
Cheers Marc
Offline