Adds lead image to any content in plone site
Project description
collective.contentleadimage
Overview
This products adds complete support for adding descriptive image to any Archetypes based content in Plone site. Each object has new tab “Edit lead image”, which allows to upload new or remove current image. It is similar behaviour as Plone News Item (you can add image to news item and this image is displayed in news item overview listing.
There is folder_leadimage_view page template, which can be used to list all items in the folder together with images attached.
There is configuration control panel, where you can set maximum width and height of the uploaded images. The width and height is applied on each image upload (image is automatically resized). You can specify smaller width and height which is used as image preview in the below content title viewlet (next to content Description). Large image is used in the above content body viewlet (floated left at the top of content body).
Below content title viewlet is preffered, but Manager can easily switch the viewlets on/off in the control panel.
There is FieldIndex and metadata in portal_catalog: hasContentLeadImage (True/False). This may help developers to create own templates optimized for displaying lead image.
Note: For Plone 4.4+ and plone.app.contenttypes based content there is support for lead image behavior out of the box. This addon is only compatible with legacy Archetypes based content.
Installation
If you are using zc.buildout and the plone.recipe.zope2instance recipe to manage your project, you can do this:
Add collective.contentleadimage to the list of eggs to install, e.g.:
[buildout] ... eggs = ... collective.contentleadimage
Tell the plone.recipe.zope2instance recipe to install a ZCML slug:
[instance] recipe = plone.recipe.zope2instance ... zcml = collective.contentleadimage
Re-run buildout, e.g. with:
$ ./bin/buildout
More detailed installation instructions may be found in docs/INSTALL.txt.
Using collective.contentleadimage with plone.app.scaling
plone.app.imaging provides dynamic image scales for all Plone images since Plone version 4.1.
Below is an example how to use @@images with with portal_catalog hasContentLeadImage metadata column to show a custom sized lead image scale in a folder listing.
Example page template snippet from a folder listing:
<div class="tileItem visualIEFloatFix" tal:define="item_has_leadimage item/hasContentLeadImage; item_object item/getObject; item_hide_from_nav item/exclude_from_nav; " tal:condition="not:item_hide_from_nav"> <img tal:condition="exists:item_has_leadimage" tal:define="scale item_object/@@images; img python:scale.scale('leadImage', width=280, height=280)" tal:replace="structure python: img.tag() if img else None" />
Here is another example how Event content type view template is modified to directly display lead image next to the event details table. The modification was done using z3c.jbot and overriding the template as Products.CMFPlone.skins.plone_content.event_view.pt.
The template head:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:i18n="http://xml.zope.org/namespaces/i18n" lang="en" metal:use-macro="context/main_template/macros/master" i18n:domain="plone"> <body> <metal:content-core fill-slot="content-core"> <metal:content-core define-macro="content-core" tal:define="kssClassesView context/@@kss_field_decorator_view; getKssClasses nocall:kssClassesView/getKssClassesInlineEditable; templateId template/getId; toLocalizedTime nocall:context/@@plone/toLocalizedTime;"> <tal:comment replace="nothing"> <!-- Show content lead image above event details on the event page. Match image dimensions to the event details table size. --> </tal:comment> <div class="lead"> <div class="lead-image-wrapper" tal:define="scale context/@@images; img python:scale.scale('leadImage', width=300, height=300)" tal:condition="img"> <img tal:replace="structure python: img.tag() if img else None" /> </div> <div class="eventDetails vcard"> <table class="vertical listing" summary="Event details" i18n:attributes="summary summary_event_details;"> <tbody>
Changelog
1.3.6 (2018-09-05)
Add french translation [laulaz]
Fix gitignore [laulaz]
Fix: Don’t set None value on hasContentLeadImage index [boulch]
1.3.5 (2014-04-30)
Register CSS Resources to render as link instead of import for better performance. [thet]
Also use IMAGE_FIELD_NAME config attributes in leadimage-body.pt [thet]
Fixed blob based images not being language neutral [miohtama]
Add french translation [toutpt]
1.3.5-FHNW1 (2012-11-29)
Fix type vocabulary to ReallyUserFriendlyTypes [amleczko]
Changed collective.contentleadimage.full registrations in zcml: we should register the viewlet with IViewView interface restriction, in this way it will be shown only in the canonical view [lucabel]
Allow contententleadimage in all skins [tom_gross]
1.3.4 - 2011/12/28
Fixed adaption to Plone 4.1 [naro]
1.3.3 - 2011/12/28
Adapted to Plone 4.1 [davidjonas]
Fixed ‘//’ bug in purge.py [adamt]
1.3.2 - 2011/05/24
Check for presence of a leadimage caption so we don’t display an empty div on the page. [davidjb]
Added new tests to check various aspects of rendering the lead image and associated captioning. [davidjb]
1.3.1 - 2011/05/20
Checking for Products.CacheSetup presence before registernig its subscriber [silviot]
add allowed_atributes to folder_leadimage_view so this view can be called from other views [shagi]
mtool variable definition added [kroman0]
remove scaled images during migration [otacon]
1.3.0 - 2010/09/15
fixed migration to blobs. Thanks to David Jonas. [naro]
1.3.0b1 - 2010/09/13
added migration to blobs [naro]
1.3.0a1 - 2010/08/19
THIS VERSION ADDS BLOB SUPPORT WHICH BECOMES DEFAULT LEAD IMAGE STORAGE IN PLONE4. MIGRATION TO BLOB IS NOT PREPARED YET! DON’T USE THIS VERSION IF YOU ARE MIGRATING TO PLONE4. IT IS SAFE TO USE IT ON PLONE3 OR PLONE4.
use correct image title (caption) in folder_leadimage_view. Fixes #2 [naro]
make leadimage languageIndependent. Fixes #1 [naro]
store images as blobs in case plone.app.blob is installed and use scales defined in plone.app.imaging see TODO.txt for possible issues [fRiSi]
fixed folder_leadimage_view to display content-type icon only for the headline (in plonetheme.sunburst the next image contained in contenttypes-sprite.png has been visible due to the height of the div) [fRiSi]
toLocalizedTime has not been available in plone4.0b2 (fetching it as folder_listing does) [fRiSi]
Added Dutch translation [maartenkling]
Added Spanish translation [pcaro]
Large Plone Folder was removed from plone4, added zcml:condition for profile - duplicated and edited profile for plone4. [hpeteragitator]
make sure the viewlets are not shown after adding and removing an image [enriquepablo]
1.2.0 - 2010/03/14
Plone 4 compatibility - added dependency on plone.indexer to be compatible with Plone 3.2-
Plone 4 compatibility - leadimage scale must be stored in plone.app.imaging properties.
1.1.7 - 2009/09/22
something went wrong with optional plone.indexer. Let’s disable it meanwhile.
1.1.6 - 2009/09/06
fixed version number
1.1.5 - 2009/09/02
use plone.indexer if possible
added controlapnel icon
reindex hasContentLeadImage index on reinstall
1.1.4 - 2008/12/16
fixed bug in migration from version 0.x. Thanks to Ben Chodoroff for pointing to it.
added Italian translation. Thanks to [paulox]
fixed spelling
1.1.3 - 2008/10/14
be more careful when accessing cli_properties property sheet in schema extender. It may be called too soon and cause AttributeError.
added uninstall code which removes configlet
1.1.2 - 2008/10/10
make lead image field language dependent. This fixes problem with Linguaplone and it helps to make multi language screenshots, for example.
1.1.1 - 2008/10/10
fixed body viewlet - image tag was there even if there was no image
fixed potential error when object schema has no ‘description’ field.
1.1 - 2008/09/23
moved integer and string properties from propertiestool.xml to setuphandlers, because properties were overriden with default values on reinstall.
removed max size settings from the controlpanel and reuse max_size from ATContentTypes settings (zconf.ATNewsItem.max_image_dimension)
images may be captioned
if image is displayed in the body, it is possible to display image fullscreen (the same as newsitem image)
it is possible to specify, which scale will be used for displaying the image in “description” part and which in “body” part.
make images “newsitem” like. Image tags uses the same CSS classes as news items, leadImage field uses the same scales as News Item plus one special ‘leadimage’ scale defined by user in the controlpanel.
it is possible to set allowed_types. Document and Folder are allowed by default.
changed CSS - define float on the leadimage-wrapper to easily style leadimage itself (for example for adding border around the image)
1.0.1 - 2008/09/11
fixed dependency on plone.browserlayer
make extender browser layer aware
1.0 - 2008/09/09
MIGRATION REQUIRED ! rewritten using archetypes.schemaextender. If you upgrade from version <1.0 please don’t forget to run upgrade step from portal_setup/Upgrades, choose the collective.contentleadimage profile, check the (0.3 - 1.0) upgrade step and press Upgrade button. [naro]
Moved leadImage field after the Descripton field. [naro]
leadImage field supports original size and one scale. [naro]
it is possible to specify maxwidth and maxheight in the controlpanel [naro]
created new viewlet in AboveContentBody viewlet manager. This viewlet displays large version of the image (size specified as maxwidth/maxheight in the controlpanel). It is possible to switch on/off both viewlets in @@manage-viewlets or in leadimage control panel. [naro]
0.4 - 2008/09/03
fixed portal action condition. There is new browser view which checks if object provides ILeadImageable interface. This view is called from action condition. [naro]
0.3 - 2008/09/03
fixed bug - hasContentLeadImage index was not registered. [naro]
added German translation. Thanks to Rainer Schaffer [naro]
fixed typo in actions.xml (second icon_expr should be available_expr) Thanks to Dan Jacka for spotting this [naro]
0.2 -
fixed docs [naro]
0.1 -
initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for collective.contentleadimage-1.3.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 544151e6cfb71c711dec18da01cc8e57f49c74f26b5e559c9a606b2aa61c0236 |
|
MD5 | bdcdd2902e663ccc1985faf00e2a7157 |
|
BLAKE2b-256 | 1efe66f5111bcc4dbbbcf36489997707ab823cc801a4c1621a97fb16132ca04f |