espenmn
(Espen)
October 20, 2017, 9:48am
1
Would it be possible to make a 'multi-file/images' field for dexterity.
... so one for example could upload one, or two or three images to a content type.
PS: I know that it is possible to 'use folders items with images', but this is not useful when you want to have two or more 'multi-file'-fields. (?)
datakurre
(Asko Soukka)
October 20, 2017, 9:53am
2
I recall there is/was already one, but it was considered a bad idea, because need for maintain separate download views and everything in addition to the default file field attribute.
dieter
(Dieter Maurer)
October 20, 2017, 5:26pm
3
espenmn:
Would it be possible to make a 'multi-file/images' field for dexterity.
... so one for example could upload one, or two or three images to a content type.
"dexterity" builds on zope.schema
and there you have List
and Tuple
fields with a way to specify the component field. I have never used a List/Tuple of Images
but a List
with Object
as component field and the result (with zope.formlib
, not z3c.form
) was acceptable: there is a button to add a further list element which can then be "filled" with data.
espenmn
(Espen)
October 22, 2017, 4:47pm
4
dieter:
List and Tuple fields
With Tuple, I am quite sure it does not work (see below) (I have tried to add objects and Image fields, basically the 'Image' is lost on save or Edit.
With List I have tried with DataGridField with more or less the same problem.
Also : It would be nice to have an UI similar to the 'Upload files'(Plone 5 or wildcard.foldercontents).
images = schema.Tuple(
title = _(u"images",
default=u"Photos"),
value_type= namedfile.NamedBlobImage(
title=_(u"Photo"),
description=u"",
required=False,
))
(or value_type= DictRow(schema=IPhotoObject)
espenmn
(Espen)
October 24, 2017, 4:46pm
5
I probably found it:
plone.formwidget.multifile
This add on looks very promising
From my view templates, I get the 'Blobfiles', :
<plone.namedfile.file.NamedBlobImage object at 0x1099f3cf8>
I can also get the filename, (some image.jpg)... not sure if that is of any use, maybe a src-url can be constructed?
.... or it might be possible to use' _data' or '_getData and src="data:
... suggestions are appreciated