I have created a custom persistent tile which I would like to use to upload/display video from. I am not concerned with transcoding the video I just need to be able to upload it in the tile setting page and be able to reference it in the template.
The only way I can see for NamedBlobImage to produce a url is to use plone scales which creates a url via the url parameter.
I see from other topics that the preferred way to do this is to add the content via a richtext file, however I want a custom template for the tile, which references the embedded video. So for the purposes of this use case a richtext tile is not an option.
check collective.cover's implementation of scaling for tiles; it's probably over-engineered (can be simplified) but it has been working for many years now:
Have you already check, how our deprecated image tile used to work:
Technically, there's custom imagescale support for persistent tiles implemented in plone.app.tiles so that it saves imagescales close to tile data. The example above uses that. It should work, but it may not have feature parity with the default plone namedfile scales. We simply cannot maintain multiple scale implementations and the current recommendation is to use image content level images also with tiles.
Thanks all for the pointers. I didn't explain very well what I'm trying to do.
I just want to get a url directly to the file that is uploaded in the tile. Something like self.data['some_file'].url but there is no url attribute, only things like data and filename.
The @@images view I think is from Pillow which exposes the data but I'm not sure of the inner workings there.
The solution I have used is to create a @@file browser view which takes the field name as a request variable and then sets the correct content type and outputs the data. So my url will look like http://localhost:8080/Plone/front-page/@@my.package.tiles.some_tile/82ff01713384464792b2efaceb93383c/@@file?field=some_file. In my tile template I can use view/absolute_url to get the tile url, so just a matter of appending @@file?field=some_field
I could add this function to plone.tiles and submit a PR if there was any interest in it?
@iojon plone.app.standardtiles' deprecated attachments-tile have example traverser supporting @@download path syntax familiar from plone.namedfile
Generic view could have its place in plone.app.tiles (as there's also the imagescales-support), but currently the mood seems to be getting rid binaries in tiles by default.