Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
Re: Automatic thumbnails for Textpattern
etc wrote #341567:
The message can be seen in the image source. Inspecting the server response is the first thing I do in such cases.
Yeah that’s what I do when debugging, but it doesn’t help people who are less well versed in using the inspector.
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
Re: Automatic thumbnails for Textpattern
The absence of the traditional 123t.ext thumbnail for automatic type looks debatable. We can adapt the core, but plugins like com_article_image expect it to be there when thumbnail != 0 in txp_image table. At least, imagesrcurl() function probably needs to be patched.
Offline
Re: Automatic thumbnails for Textpattern
If it’s a problem, we can always make it, regardless. Or patch com_article_image to understand thumbnail = 2.
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
Re: Automatic thumbnails for Textpattern
Would it be possible to force an output format when using <txp:image_url thumbnail width="123" />?
eg. .png to .jpg or .avif
I regularly come across poor PageSpeed rankings due to the format of the original image (typically .png used for photo imagery).
Offline
Re: Automatic thumbnails for Textpattern
giz wrote #341584:
Would it be possible to force an output format when using
<txp:image_url thumbnail width="123" />?
Hmm, I can’t see that as a parameter in the docs. Under the hood it does a like-for-like downsize, retaining the original format.
In theory, once the incoming stream has been converted to an image in memory, it should be possible to divert it to a different format by overriding the default ‘use the same format’ when calling ->render(). But it’s tied internally to the mime type (because it needs to serve that) and there are function call upon call upon call that are chained together to detect those.
If I can unpick some of that, there might be a way we can wire up a parameter like /tavif/ and use that as the mime type and then it should spit out the converted image. I’ll have a play, but I’m not sure how successful it’ll be at this stage.
Last edited by Bloke (Yesterday 18:30:14)
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
Re: Automatic thumbnails for Textpattern
Is there an option to create two alternative thumbnail resizing when uploading an image: ie. thumbnail 1 and thumbnail 2?
So that when uploading an image, say of a size 400×800, thumbnail 1 could be resized to 200×400 and thumbnail 2 to 100×200?
Would be useful to accommodate media sizes as in this example:
<source srcset="https://mysite.ca/img/portfolio/screen-1-small.png" media="(max-width: 30em)">
<source srcset="https://mysite.ca/img/portfolio/screen-1-medium.png" media="(max-width: 48em)">
<source srcset="https://mysite.ca/img/portfolio/screen-1.png">
or should one simply create the alternate sizes before uploading?
…. texted postive
Offline
Re: Automatic thumbnails for Textpattern
bici wrote #341586:
Is there an option to create two alternative thumbnail resizing when uploading an image
There’s no need. That’s the point. If you want two or more different sizes in your srcset, just put the tags there and the images will be created at whatever widths / heights you specify.
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
Re: Automatic thumbnails for Textpattern
Bloke wrote #341588:
There’s no need. That’s the point. If you want two or more different sizes in your srcset, just put the tags there and the images will be created at whatever widths / heights you specify.
prefect! … I hadn’t realized that . But I still need one thumbnail so all good!
…. texted postive
Offline
Re: Automatic thumbnails for Textpattern
bici wrote #341586:
Is there an option to create two alternative thumbnail resizing when uploading an image … or should one simply create the alternate sizes before uploading?
Bloke wrote #341588:
There’s no need. That’s the point. If you want two or more different sizes in your srcset, just put the tags there and the images will be created at whatever widths / heights you specify.
bici, with the new method, you would do something like this for your situation (using your chosen widths and img id#s):
<txp:images id="1,2,3" wraptag="picture" break="">
<source srcset="<txp:image_url thumbnail width="1600" />" media="(width >= 800px)">
<source srcset="<txp:image_url thumbnail width="1200" />" media="(width >= 600px)">
<img src="txp:image_url />" alt="txp:image_info type="alt" />">
</txp:images />
But if you wish to use the source tag expressly to art direct your images, i.e. your images are actually different at the respective sizes, you may need to go back to the old method of creating your individual sizes and uploading the other(s) as a thumbnail. If you have several, you’d still need smd_thumbnail for that.
TXP Builders – finely-crafted code, design and txp
Offline
#71 Today 02:58:06
Re: Automatic thumbnails for Textpattern
jakob wrote #341591:
bici, with the new method, you would do something like this for your situation (using your chosen widths and img id#s):
<txp:images id="1,2,3" wraptag="picture" break="">...But if you wish to use the
sourcetag expressly to art direct your images, i.e. your images are actually different at the respective sizes, you may need to go back to the old method of creating your individual sizes and uploading the other(s) as a thumbnail. If you have several, you’d still need smd_thumbnail for that.
tested and it works fine. thanks.
…. texted postive
Offline