Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#277 2025-12-27 20:16:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,399
Website GitHub

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

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,173
Website GitHub

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

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,173
Website GitHub

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 2026-01-15 20:32:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,399
Website GitHub

Re: Automatic thumbnails for Textpattern

[I split bici’s questions about the custom thumbnails to their own topic.


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

#281 Today 20:19:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,399
Website GitHub

Re: Automatic thumbnails for Textpattern

A couple of recent commits of note here. Firstly, I’ve allowed you to specify your own memory_limit (in MB) via your config.php. For anyone who is using larger source images and doesn’t mind the wait time (and potential crashage of the server due to overloading it), feel free to bump this up or down for performance. If you find a bunch of thumbs are not being created, it may be the automatic generator is maxing out.

The best solution in this situation is to batch process your images to slightly lower resolution prior to uploading them to the Images panel, but if you absolutely must have super hi-res images, tweaking this value might help.

Secondly, I found that subdir installations now fail to create thumbs if the subdir is also part of the site_url. It resulted in duplication of the overlapping portion so this commit tries to rectify that. I’m especially interested if it still works for your virtual host environment, Robert, since I don’t have a setup here that simulates that. Hopefully it carries on working but if it breaks, please let me know what values you’re seeing in the URLs compared with what you expect and I’ll try and figure it out.


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

Board footer

Powered by FluxBB