Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#277 2025-12-27 20:16:59
Re: Automatic thumbnails for Textpattern
Right click a thumbnail that purports to be automatic (i.e. has /thumb/w800/… in it) and open in a new tab. If the process is failing you should see an error message in the browser.
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
#278 2025-12-27 23:00:39
Re: Automatic thumbnails for Textpattern
I get a 404 and this page source:
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
and this response:
Übersicht
URL: https://domain.com/images/thumb/w800/1.jpg?token=8140119e540a03e3fa8a0f587490f68f22e99ff0bfa06d4297ec1bacf1fd8e48
Status: 404
Quelle: Netzwerk
Adresse: xxx.xxx.xxx.xxx:443
Anfrage
:method: GET
:scheme: https
:authority: domain.com
:path: /images/thumb/w800/1.jpg?token=8140119e540a03e3fa8a0f587490f68f22e99ff0bfa06d4297ec1bacf1fd8e48
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: de-DE,de;q=0.9
Cookie: txp_login_public=986048ffd3julian; PHPSESSID=e310c00047975644b7a08ef70a222c94
Priority: u=0, i
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15
Antwort
:status: 404
Content-Encoding: br
Content-Type: text/html
Date: Sat, 27 Dec 2025 22:59:58 GMT
Server: nginx
Vary: Accept-Encoding
Parameter der Abfragezeichenkette
token: 8140119e540a03e3fa8a0f587490f68f22e99ff0bfa06d4297ec1bacf1fd8e48
TXP Builders – finely-crafted code, design and txp
Offline
#279 2025-12-27 23:43:16
Re: Automatic thumbnails for Textpattern
I think I’ve identified it as a problem in the default nginx vhost that I don’t quite understand yet.
It has a section as follows:
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|woff2|eot|mp4|ogg|ogv|webm|webp|zip|swf|map|mjs)$ {
add_header Access-Control-Allow-Origin "*";
add_header alt-svc 'h3=":443"; ma=86400';
expires max;
access_log off;
}
Removing jpg|jpeg from that list allows the images to appear. I need to learn what that means and then see what I should correct or exclude from that. But that’s a problem for tomorrow.
EDIT: Additional observations after further investigation:
Normal images seem to be handled just fine, so it looks like just the initial redirect to thumbnail creation situation that occurs when a token is passed isn’t being handled. To test that, I temporarily removed the image extensions from that list allows txp to create the thumbs, then restored the original nginx directive including the image extensions. The thumbnails created in the /images/thumb/…directories now work, just the new creation of thumbs doesn’t.
@gaekward or anyone else? Is there a way of either passing through image requests that result in a 404 or 301 to the thumbnail creation routine, and / or is there a way of excluding location regexs that contain a ?token= url parameter from this directive?
TXP Builders – finely-crafted code, design and txp
Offline
#280 Today 02:45:58
Re: Automatic thumbnails for Textpattern
none of these two options output the correct size image:
I have then in a TXP Form:
<txp:thumbnail id="16" class="portfolio__nav__img" />
The thumbnail sizes on the Images panel is at 324×200 , but the image output is large … but if I right click to show image in a new window it is the proper size.
This also fails to render a small 324×200 image:
<img src="../images/16t.png" width="324" height="200" alt="nav" class="portfolio__nav__img">
but if I enter this html
<a href="https://example.ca/portfolio/bikes_wheels" class="portfolio__nav__item grid__item one-half medium--one-half wide--one-third is-active">
<img src="https://example.ca/assets/portfolio/nav-bici.png" width="324" height="200" alt="nav-solutions" class="portfolio__nav__img">
<h4 class="portfolio__nav__title">BikeHistory</h4>
<div class="portfolio__nav__role">Website Design</div>
</a><!-- 1 -->
the image is output at the right size of 324×200
Last edited by bici (Today 03:15:27)
…. texted postive
Offline
#281 Today 06:17:42
Re: Automatic thumbnails for Textpattern
bici wrote #342225:
none of these two options output the correct size image
You need to specify at least a width to get a resized thumbnail. And in the 2nd example, you’re trying to output the ‘t’ version which is a custom thumb. Does it exist? And why the path ../images?
Also, what type of thumbnail is image id 16? Automatic? Custom? None?
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
#282 Today 07:35:06
Re: Automatic thumbnails for Textpattern
bici wrote #342225:
none of these two options output the correct size image:
You have several variants there that all slightly miss the mark.
- The first needs a
width="324to trigger the automatic thumbnail generation. - The second doesn’t use a Textpattern tag and targets a
/images/#t.jpgfile. That could work if your thumbnail is the custom type (e.g. how things have always been in Textpattern prior to the automatic thumbnailing capabiity). For that you need to have “custom” as the thumbnail type and have created a corresponding thumbnail file in the Content › Images panel. - The third likewise doesn’t use a Textpattern tag and targets an image you likely uploaded via FTP in the
/assets/directory.
In short, if you want to use automatic thumbnail generation, what you probably want is:
<txp:permlink class="portfolio__nav__item grid__item one-half medium--one-half wide--one-third is-active">
<txp:article_image width="324" limit="1" class="portfolio__nav__img" />
<txp:title wraptag="h4" class="portfolio__nav__title" />
<txp:category1 wraptag="div" class="portfolio__nav__role" />
</txp:permlink>
or something along those lines. This assumes you have the image id in the article image field and have used Category 1 for your project type classification.
TXP Builders – finely-crafted code, design and txp
Offline