01569: Posters for bare URL videos

Summary: Posters for bare URL videos
Created: 2026-09-16 06:52
Status: Open
Category: Cookbook
From: Petko
Assigned:
Priority: 1
Version: 2.7.5
OS:

Description: From gnuzoo, about PmWiki.Media:

> For locally uploaded files, PmWiki will also search for related pictures 
> and subtitles/captions/chapters, that is the same basename and a different 
> extension, and will include them in the player.
>    Poster (cover) pictures: webp, jpg, jpeg, png 

Poster appears to only work with the "Attach:" and not with
the direct URL. Even when the poster fails the video still works.

My poster filename is Slaughterbots.jpg in the same diretory.

Poster works:

    Attach:Slaughterbots.mp4#x320;class=videoframegraysilver

Poster does not work:

    (:UPL:http://localhost/z/uploads/:)
    {$:UPL}Slaughterbots.mp4#x320;class=videoframegraysilver

--gnuzoo

Indeed, it was already documented earlier but I also clarified this sentence. --Petko

You documented a poster works for media that use the "Attach: link" but did not
mention it does not work for media that use "bare remote URL, without brackets".

> Embedding media players is similar to embedding images in wiki pages, with the
> "Attach: link" or the "bare remote URL, without brackets".

I would like to see the poster implemented/adjusted for media that use "bare remote URL, without brackets" too.

--gnuzoo

Doc updated. --Petko

> This does not apply to URL, Path:, or [[InterMap]], only to %pmhlt%[@Attach: links.@]

Why does this not apply? Cannot the PmWiki program check to see if the file is a mp4 (video)
and if so use the same path as the file to see if there is a filename matching jpg (poster)?
Is it too much to program, or just not programmed yet? Do you have a Media todo list?

--gnuzoo

Attach: links are a core PmWiki function that maps a filesystem path to a URL. It takes a few milliseconds to scan the whole filesystem directory for related files (different media formats, different poster formats, different subtitles/captions/chapters, different languages). The PHP glob() and even file_exists() functions do not work over http: or https:, including InterMap. For your case, there are 2 workarounds: (1) replace http://localhost/z/uploads/ with Attach: as documented, who would have thunk, crazy right?, and (2) ask your favorite LLM how to use ffmpeg to place your poster as the first frame of your video, and reupload that file, no need for a separate poster image. The browser will happily show that frame when the page loads. --Petko

That all makes sense. How about adding a poster to the "hash fragment".

{$:UPL}Slaughterbots.mp4#x320;class=videoframegraysilver;poster="{$:UPL}Slaughterbots.jpg"

--gnuzoo

Such a feature may be better left to be implemented by a recipe, this way we could see how popular it is before increasing the complexity of the core and taking from my limited spare time. --Petko

http and https do allow you to obtain the filename. Strip off the extension and search
in the $UploadDir for a poster match. Perhaps search other 'known' Pmwiki locations.
That would work. Perhaps adding a line in config.php - $PosterDir = "uploads/; videos/;".

--gnuzoo

Since you moved this page from Media-Talk to
PITS, does that mean you plan to implement this?

--gnuzoo