[pmwiki-users] resize an image during uploading and redirect after uploading
Petko Yotov
5ko at 5ko.fr
Mon Aug 23 02:20:40 PDT 2021
On 23/08/2021 07:32, Benjamin Grassineau wrote:
> 1. Do you think there is a method to automatically (on the fly) reduce
> the physical size of images uploaded to pmwiki ? I did not find a
> simple solution.
I wouldn't call it "simple", but the recipes AutoThumber and
ImagesAutoResizing claim to do something like this:
https://www.pmwiki.org/wiki/Cookbook/AutoThumber
https://www.pmwiki.org/wiki/Cookbook/ImagesAutoResizing
> 2. I don't understand how the $ UploadRedirectFunction variable works.
> I would just like to redirect the user to the page after downloading
> in viewer mode. Would it be possible to have just one example because
> my various tests are unsuccessful ?
This is a function that will be called instead of Redirect() with the
same arguments.
Here is an example:
$UploadRedirectFunction = 'BenUploadRedirect';
function BenUploadRedirect($pagename, $url) {
global $FmtV; # see $FmtV in HandlePostUpload (upload.php)
# if not successfully uploaded, go back to upload form
# (bad file type, larger file, other error):
if($FmtV['$upresult'] != "upresult=success")
return Redirect($pagename, $url);
# here you could do something else,
# possibly downscale pic, or log, or nothing
# redirect to page, not to upload form
Redirect($pagename);
}
Petko
More information about the pmwiki-users
mailing list