Uploads-Talk

Testing the .webp image extension fails to display an image. Viz https://www.pmwiki.org/pmwiki/uploads/Test/image.webp

simon May 23, 2020, at 04:26 AM

You can enable the extension in $ImgExtPattern but the current versions of 2 major browsers (MSIE, Safari) and all browsers on iOS/iPhoneOS/iPadOS do not support embedding such pictures, the webpage will display nothing or an empty frame. (caniuse) --Petko May 23, 2020, at 06:37 AM

PmWiki.Uploads documents .webp as a supported image extension. IE is no longer a major browser, Safari has approx 22% of the market. I'd recommend that this open source smaller superior format should be enabled by default for the majority of the market that can use this format.

PmWiki.Uploads documents .webp as an allowed upload extension (which happens to be a picture). Embedded pictures carry content that is usually important or critical to the page. They are unlike other partially adopted tech (input date, details, datalist) which do not impact the content of the page. I prefer leaving a decision to exclude a billion people (22% of 4.5B) to the wiki administrator, who may also want to tell his/her visitors that they are not welcome to his/her wiki. As of today, denied. --Petko May 24, 2020, at 03:19 AM


Is it possible to support the markup to set image size

[[https://example.com | %width=99px%Attach:image.jpeg%%]] (which doesn't work) as well as
%width=99px%[[https://example.com | Attach:image.jpeg]]%% (which does)
simon May 23, 2020, at 04:26 AM

No, Embedded pictures markup is particular and only processed inside links when the link text contains nothing but a link to a picture (with possible title/alt). Please use the second example which works. Alternatively, style that picture with CSS, there are several ways to do it, eg below. --Petko May 23, 2020, at 06:37 AM

/* all pictures inside links */
#wikitext a img { width: 99px; }

/* only "image.jpeg" inside links */
#wikitext a img[src$="image.jpeg"] { width: 99px; }

I'd like to upload *.ics-files. If I change upload.php, it will be overwritten by the next update. Is there another way?

Absolutely, see UploadsAdmin#newuploadfiletypes. For iCalendar files, the line in config.php would be:

  $UploadExts['ics'] = 'text/calendar'; 

You should never have to modify core files with PmWiki, everything can be configured, enabled or changed from config.php -- if it cannot, we'll add it. --Petko December 16, 2019, at 11:49 AM


For images (e.g., [[Attach:image.jpg"mouse over tool" | Caption text ]]) how is a caption text specified in the same way as described on the images page? The example as shown does not seem to work

simon April 28, 2019, at 10:08 AM

Use Attach:image.jpg"mouse over tool" | Caption text --Petko


After you upload something, you are redirected to a URL like "Main/HomePage?action=upload&uprname=some_image.jpg&upresult=success". Is there a way to just have it redirect back to whatever page you were on (like Main/HomePage) with no "?action"?

You can define your own global $UploadRedirectFunction that will be called with the pagename and the default URL. If the URL ends with "&upresult=success" your function can redirect to $pagename, otherwise to the URL (there will be messages about why the upload failed). Note that a successfully uploaded file may be renamed in many cases, for example uploads can only have lowercase extensions, then the ?action=upload page will show the new filename (this cannot be detected from inside $UploadRedirectFunction). --Petko August 28, 2018, at 05:51 AM


There is a new type of attribute to html5, called 'integrity'. Usually it has the md5sum of the file to automagically check for integrity. If the integrity check fails, the browser won't allow you to download the file. Why I believe this is somewhat important? Because some of the files were altered before some changes that where made to PmWiki to catch downloads on AllRecentChanges. For instance the file I refer to is phpmerge.php on the page SimultaneousEdits that has a call to a non-existant function, and by the way, this recipe should be part of the distro as I believe most people don't use a full host with access to all the linux commands, but use more shared hosts I believe. CarlosAB January 13, 2017, at 10:24 PM

OBS: It looks like it can only be used on link and script elements, not sure yet.


I think the UploadQuickReference should be changed to say "Use the top button above to find the "FIle to upload" on your local computer. Currently it says use the "Browse" button, which is what Firefox calls the button, but Safari and Chrome call it a "Choose file" button, and Opera calls it a "Choose…" button. It would be less confusing to users to simply refer to the "top" button. -- RandyB September 18, 2014, at 12:37 AM

Agreed. Also, on a localized browser, the button text is translated into the language of the user. --Petko September 18, 2014, at 03:19 AM

How does the translate work when "Choose file" does not appear to be a string that can be localised?

simon September 18, 2014, at 06:32 PM

The string "Site.UploadQuickReference" can be localized, then another (translated) page will be used. As explained above, the button is labeled differently in different browsers in the same language, so we don't need to insist on the button label. --Petko September 19, 2014, at 01:47 AM


I'd like to include some pages that contain some attachments. But I don't want to have to add {$Group}./ or {$FullName}./ to all Attach links: I'll forget most of them! Any workaround? Tia.

How do I prevent files being uploaded with no extension?

See the Uploads Admin page

Subdirectories?

Is it possible to create subdirectories for organizing attachments (within the same group)? Specifically, I'm thinking of images... would be very handy....

thanks, Mike

Yes, see the variable $UploadPrefixFmt in UploadsAdmin. --Petko December 28, 2009, at 03:48 AM


Is there a way to hide the "triangle" behind attachment links? Perhaps make it visible to logged in users only? Thanks.

Add to your config.php :

To hide the "triangle"
$LinkUploadCreateFmt = "<a rel='nofollow' class='createlinktext' href='\$LinkUpload'>\$LinkText</a>";

To restore the default behavior to only logged in users (assuming using AuthUser)
if (@$_SESSION['authid']) { $LinkUploadCreateFmt = "<a rel='nofollow' class='createlinktext' href='\$LinkUpload'>\$LinkText</a><a rel='nofollow' class='createlink' href='\$LinkUpload'>&nbsp;&Delta;</a>"; }

Antony Templier October 12, 2011, at 08:19 AM

Thanks, that worked great for hiding the delta! But it is not showing up for logged in users. Could the problem be that I'm using Cookbook.UserAuth2?

John October 12, 2011, at 9:51 AM (EST)

Yes, this tip is for the default authorization system : AuthUser. For UserAuth2, maybe you can try this (but i don't use it, you 'll have to validate yourself) :

To restore the default behavior to only logged in users (assuming using UserAuth2)
if (@$GLOBALS['IsUserLoggedIn']) { $LinkUploadCreateFmt = "<a rel='nofollow' class='createlinktext' href='\$LinkUpload'>\$LinkText</a><a rel='nofollow' class='createlink' href='\$LinkUpload'>&nbsp;&Delta;</a>"; }

Antony Templier October 12, 2011, at 11:36 AM


This is a talk page for improving PmWiki.Uploads.