collective.contentleadimage

by Radim Novotny last modified Dec 28, 2011 09:00 PM

Adds lead image to any content in plone site

Project Description

collective.contentleadimage Package Readme

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.

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.

Changelog

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

Current Release
collective.contentleadimage 1.3.4

Released Dec 28, 2011

Download file Get collective.contentleadimage for all platforms
collective.contentleadimage-1.3.4.zip
If you are using Plone 3.2 or higher, you probably want to install this product with buildout. See our tutorial on installing add-on products with buildout for more information.

All Releases

Version Released Description Compatibility Status
1.3.4 Dec 28, 2011 More about this release… final
1.3.3 Dec 28, 2011 More about this release… final
1.3.2 May 24, 2011 More about this release… final
1.3.1 May 20, 2011 More about this release… final
1.3.0 Sep 15, 2010 More about this release… final
1.2.0 Mar 14, 2010 Plone 4 compatibility More about this release…
Plone 4
Plone 3
final
1.1.7 Sep 22, 2009 More about this release… final
1.1.5 Sep 03, 2009 More about this release… final
1.1.4 May 01, 2009 ...copied from PyPI... More about this release…
Plone 3
final
1.1 Sep 23, 2008 Many improvements based on Jon Stahl's blog entry. More about this release…
Plone 3
final
1.0.1 Sep 11, 2008 Bugfix release More about this release…
Plone 3
final
1.0 Sep 09, 2008 Refactored to use archetypes.schemaextender. This release fits more to default Plone look and feel. More about this release…
Plone 3
final
0.2 Mar 26, 2008 Bugfix release More about this release…
Plone 3
final
0.1 Mar 24, 2008 First public release. More about this release…
Plone 3
final

Comments (11)

Rebel X May 19, 2011 08:58 PM
When using the folder_lead_image_view for News Items, an error occurs:

NameError: name 'mtool' is not defined

This can be resolved by replacing the followng line in folder_leadimage_view.pt

tal:define="author python:mtool.getMemberInfo(item_creator)">

by

tal:define="mtool mtool|context/portal_membership; author python:mtool.getMemberInfo(item_creator)">

A bug report was submitted by David Pico via the product's Issue Tracker on November 26, 2010. Why is a fix still not implemented?
Radim Novotny May 20, 2011 01:29 PM
Sorry for the delay. Version 1.3.1 is released now.
Alberto Moral Nov 09, 2011 01:51 AM
Plone 4.1.2 / Debian 5.0.9 (lenny)

Products installed:
    AT Google Maps 0.7
    Collage 1.3.6
    Content Lead Image 1.3.2
    ContentWellPortlets 4.0
    Diazo theme support 1.0b8
    LinguaPlone 4.0.1
    PloneFormGen 1.6.0
    Static resource storage 1.0b5
    collective.easyslider 0.7.4
    collective.plonetruegallery 1.3.3

Error:
  Module collective.contentleadimage.browser.viewlets, line 25, in bodyTag
  Module Products.Archetypes.Field, line 2606, in tag
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128

Traceback complete: http://www.poeticsoft.com/[…]/collective.contentleadimage_01.html

To reproduce error:
Create Folder with latin chars (ñ, á, etc...) in title. Add a content lead image. Save.
Fabrizio Rota Dec 28, 2011 08:23 PM
Installing (via buildout) in Plone 4.1.3 (linux plone.org installer), when I start Plone I get this error:


Traceback (most recent call last):
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/run.py", line 72, in <module>
    run()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/run.py", line 21, in run
    starter.prepare()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/__init__.py", line 86, in prepare
    self.startZope()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/__init__.py", line 259, in startZope
    Zope2.startup()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/__init__.py", line 47, in startup
    _startup()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/startup.py", line 118, in startup
    load_zcml()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/startup.py", line 52, in load_zcml
    load_site()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/zcml.py", line 46, in load_site
    _context = xmlconfig.file(site_zcml)
  File "/usr/local/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 651, in file
    context.execute_actions()
  File "/usr/local/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 626, in execute_actions
    callable(*args, **kw)
  File "/usr/local/Plone/buildout-cache/eggs/AccessControl-2.13.4-py2.6-linux-x86_64.egg/AccessControl/security.py", line 165, in protectClass
    permission = getUtility(IPermission, name=permission_id)
  File "/usr/local/Plone/buildout-cache/eggs/zope.component-3.9.5-py2.6.egg/zope/component/_api.py", line 169, in getUtility
    raise ComponentLookupError(interface, name)
zope.configuration.config.ConfigurationExecutionError: <class 'zope.component.interfaces.ComponentLookupError'>: (<InterfaceClass zope.security.interfaces.IPermission>, 'cmf.ManagePortal')
  in:
  File "/usr/local/Plone/buildout-cache/eggs/collective.contentleadimage-1.3.2-py2.6.egg/collective/contentleadimage/browser/configure.zcml", line 30.4-36.6
      <browser:page
           name="contentleadimage-controlpanel"
           for="Products.CMFPlone.interfaces.IPloneSiteRoot"
           class="..leadimageprefs.LeadImagePrefsForm"
           layer="..interfaces.ILeadImageSpecific"
           permission="cmf.ManagePortal"
      />
Without contentleadimage in buildout.cfg, plone starts.
Can you help me?
Radim Novotny Dec 28, 2011 08:43 PM
Hi, I've released version 1.3.3. Please update your buildout.
Fabrizio Rota Dec 28, 2011 08:54 PM
I updated the buildout (pinning for version 1.3.3), but I still have this error:

Traceback (most recent call last):
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/run.py", line 72, in <module>
    run()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/run.py", line 21, in run
    starter.prepare()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/__init__.py", line 86, in prepare
    self.startZope()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/Startup/__init__.py", line 259, in startZope
    Zope2.startup()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/__init__.py", line 47, in startup
    _startup()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/startup.py", line 118, in startup
    load_zcml()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/startup.py", line 52, in load_zcml
    load_site()
  File "/usr/local/Plone/buildout-cache/eggs/Zope2-2.13.10-py2.6.egg/Zope2/App/zcml.py", line 46, in load_site
    _context = xmlconfig.file(site_zcml)
  File "/usr/local/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/xmlconfig.py", line 651, in file
    context.execute_actions()
  File "/usr/local/Plone/buildout-cache/eggs/zope.configuration-3.7.4-py2.6.egg/zope/configuration/config.py", line 626, in execute_actions
    callable(*args, **kw)
  File "/usr/local/Plone/buildout-cache/eggs/AccessControl-2.13.4-py2.6-linux-x86_64.egg/AccessControl/security.py", line 165, in protectClass
    permission = getUtility(IPermission, name=permission_id)
  File "/usr/local/Plone/buildout-cache/eggs/zope.component-3.9.5-py2.6.egg/zope/component/_api.py", line 169, in getUtility
    raise ComponentLookupError(interface, name)
zope.configuration.config.ConfigurationExecutionError: <class 'zope.component.interfaces.ComponentLookupError'>: (<InterfaceClass zope.security.interfaces.IPermission>, 'cmf.ManagePortal')
  in:
  File "/usr/local/Plone/buildout-cache/eggs/collective.contentleadimage-1.3.3-py2.6.egg/collective/contentleadimage/browser/configure.zcml", line 31.4-37.6
      <browser:page
           name="contentleadimage-controlpanel"
           for="Products.CMFPlone.interfaces.IPloneSiteRoot"
           class="..leadimageprefs.LeadImagePrefsForm"
           layer="..interfaces.ILeadImageSpecific"
           permission="cmf.ManagePortal"
      />
Radim Novotny Dec 28, 2011 09:03 PM
Sorry :) Please try version 1.3.4
Fabrizio Rota Dec 28, 2011 09:08 PM
Perfect: now Plone starts. Many thanks!
Fabrizio Rota Dec 29, 2011 08:56 AM
Unfortunatelly as soon as I add collective.contentleadimage to a new 4.1.3 Plone site I get this error:

Traceback (innermost last):
  Module ZPublisher.Publish, line 134, in publish
  Module Zope2.App.startup, line 301, in commit
  Module transaction._manager, line 89, in commit
  Module transaction._transaction, line 329, in commit
  Module transaction._transaction, line 443, in _commitResources
  Module ZODB.Connection, line 567, in commit
  Module ZODB.Connection, line 623, in _commit
  Module ZODB.Connection, line 675, in _store_objects
  Module ZODB.blob, line 681, in storeBlob
  Module ZODB.blob, line 666, in _blob_storeblob
  Module ZODB.blob, line 392, in getPathForOID
AssertionError

I get the same error with sites migrated to 4.1.3 when I edit a folder containg a leadimage.
Fabrizio Rota Jan 02, 2012 05:03 PM
As suggested on the IRC, it seems that my blobstorage was screwed up.
Using another backup file for blobstorage, everything seems to work.
Fabrizio Rota Jan 02, 2012 05:03 PM
As suggested on the IRC, it seems that my blobstorage was screwed up.
Using another backup file for blobstorage, everything seems to work.