使用原型,您可以覆盖图像内容类或使用以下架构创建您自己的自定义图像内容类。
您只需添加一行即可
allowable_content_types = ('image/gif', 'image/jpeg', 'image/png'),
到你的模式
ie
MyImageSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
ImageField('image',
required = False,
allowable_content_types = ('image/gif', 'image/jpeg', 'image/png'),
storage=AttributeStorage(),
sizes= {'large' : (768, 768),
'preview' : (400, 400),
'mini' : (200, 200),
'thumb' : (128, 128),
'tile' : (64, 64),
'icon' : (32, 32),
'listing' : (16, 16),
},
widget = ImageWidget(
label=_(u"Image"),
show_content_type=False,
),
),
我可能会使用模式扩展器来扩展 Image 类,覆盖该特定字段
http://weblion.psu.edu/services/documentation/developing-for-plone/products-from-scratch/schemaextender http://weblion.psu.edu/services/documentation/developing-for-plone/products-from-scratch/schemaextender