[pmwiki-users] Using the Mini Recipe - Broken ?

Petko Yotov 5ko at 5ko.fr
Tue May 7 09:17:54 PDT 2019


On 07/05/2019 03:16, Philippe Krait wrote:
> I'm trying to use the "Mini" Recipe again as it has always worked well 
> in
> the past. I have also changed the environment, I'm now hosted instead 
> of
> using my own server, which might make a difference.
> 
> Anyway, the problem is that it still works to display existing minis on
> existing pages, but the script seems to be broken as it does not 
> generate
> new minis for new pictures. Everything else seems to work, the links 
> are
> there and the image display works, but I get the "unknown" image box
> instead of the minis, normal as they are not being generated.

When migrating to a new hosting environment, sometimes there are 
differences with page permissions.  Can you upload a new picture with 
the ?action=upload PmWiki function? If you can, Mini should work with 
the same permissions. Otherwise read the documentation of your hosting 
on what permissions the directories need to have, and you may need to 
fix the permissions of any existing directories. (When creating a new 
uploads subdirectory PmWiki in most cases can calculate and set the 
correct permissions but this is not done for already existing ones.)

Can you insert a picture with Attach:new.jpg in a page, say 
Main.WikiSandbox, does the picture appear embedded in the page? When you 
change this to Mini:new.jpg what happens, does it show the alt text as 
if the thumbnail file doesn't exist? Right-click on the thumbnail or alt 
text, select "Open picture in new tab" (or something like this), what 
does it say when you open that URL? Going back to the ?action=upload, do 
you see a file like "th00---new.jpg.jpg" in the list of attachments?

Have you enabled Caching for Mini? Do you have other recipes/additional 
functions enabled for Mini? If so, first disable them until the rest is 
fixed.

Sometimes the server needs to have the GD functions specifically enabled 
in PHP: on Ubuntu I need to install the package "php7.3-gd".

If the original picture is very large, the server may need a lot of 
memory to process it. Try with a picture smaller than, say, 900x900 
pixels. PHP may need between 3 and 4 bytes per pixel, so if you upload a 
24 Mpx photo (5696 x 4272 pixels) the PHP process will need at least 72 
MB RAM (actually a little more). If it doesn't have enough memory, it 
will crash. See the recipe SystemLimits in the Cookbook on what to try.

Have you tried loading the page in a different browser?

> I have tried looking at the code but unfortunately, it's a bit too 
> advanced
> for me, I don't know how the minis are generated and when, it might be
> linked to the "action=mini" that I don't truly understand either.

When a page is saved, Mini checks if thumbnails for the selected 
pictures already exist, and if they are newer than the originals. If so, 
it simply embeds the existing thumbnails.

If there are pictures without thumbnails, or with thumbnails last 
modified (usually "created") before the last modification stamp of the 
originals, then it embeds in the HTML of the page a special URL to 
itself with ?action=mini.

When the browser requests that action=mini URL, a new thumbnail is 
created from the original, saved to the uploads directory and sent 
directly to the browser. On subsequent page requests, as the thumbnail 
already exists, the URL in the page will be its direct URL, so the 
browser gets it faster.

> Anyway, suggestions would be appreciated as this is a really great and
> simple recipe. I am using the latest version site, downloaded it 
> yesterday
> to be sure.

I assume you use PmWiki 2.2.114 and Mini 20181115.

Which version(s) of PHP, PmWiki and Mini

Are there any messages in the Apache or PHP error logs?

Is there a public URL we could review? Ideally with a way to upload a 
new file for the testing.

Petko




More information about the pmwiki-users mailing list