ImagePlacement

Categories

Component ID

455594

Component name

ImagePlacement

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1101

Component created

Component changed

Component body

Allows drag'n'drop placement of Imagefield/Imagecache images into nodes by providing a "Place images" local task right beside the normal "Edit" link of a node. For the moment it is limited to floating left and right and getting placed to the top or bottom of the node's body, inserting into paragraphs will be coming soon.

Installation

  1. First follow normal module installation procedures.
  2. Modify your node.tpl.php file slightly to make the container div have a different element ID if it's a teaser or full node. Don't worry, it's pretty easy and shouldn't break your theme, if so, it's probably already broken ;) You need to add <?php if ($teaser) { print '-teaser'; } ?> in what looks like:
    <div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
    

    Which becomes:

    <div id="node-<?php print $node->nid; ?><?php if ($teaser) { print '-teaser'; } ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
    

    What we're doing is simply adding <?php if ($teaser) { print '-teaser'; } ?> to make sure that full nodes get an element ID of "#node-nid" and teasers get "#node-nid-teaser". That way, when displaying a list of nodes as full nodes or teasers, imageplacement can determine from the DOM what image placement setting it needs to apply to a node. See #457122: Node preview creates the DOM element #node-nid twice for details on this issue.

  3. Go to Site configuration / ImagePlacement and enable the content types for which you want this functionality. You can also choose to group images per content type.