This is a similar approach to
http://drupal.org/node/81102 (D6)
http://drupal.org/node/253503 (D6)

This patch is for D5!!

It modifies the image_attach-module to support multiple attached images per node.

The patch modifies the module and the install file. it is based on image-5.x-2.0-alpha1!!

It will not interfere with extisting images attached to nodes. It only shows 1 image in teaser or full node as this is the known behaviour -- even if there are more images attached to the node.

Modifications

Modifications to module:

  • - Block shows all attached images
  • - node-edit lets you choose multiple existing images to add to the node
  • - node-edit lets you upload multiple new images (one after another, by hiting "preview")

Modifications to install-file:

  • - added a new update-function, to drop the primary key and the key iid. Afterwards it adds a new primary key(nid, iid).

    caution: I don't have put in code for pgsql!! got no clue on that :/

Comments

maulwuff’s picture

Assigned: Unassigned » maulwuff
StatusFileSize
new9.41 KB

sorry for bringing up a reworked patch so fast.
I had some trouble in the theming-functions.
Now you can easily switch between "show 1 image as usual" or "show all attached images" by commenting out only 1 line:

for teaser it's line 466
for body it's line 495.

the lines are preceded with:
//drop the following line to show all images attached to the node:
(search for this, if the line-numbers don't fit)

maulwuff’s picture

Title: Attach Multiple Images with image_attach » Attach Multiple Images with image_attach for D5
Version: 6.x-1.x-dev » 5.x-2.0-alpha1
Status: Needs work » Needs review
StatusFileSize
new9.76 KB

Found another issue when I disabled Lightbox.
The path for the thumbs in the attached image block was not prepared for arrays.

Here is the complete patch.

edit: run the update.php from the modules page after applying the patch.

drewish’s picture

Version: 5.x-2.0-alpha1 » 6.x-1.x-dev
Status: Needs review » Needs work

this functionality sounds really cool but needs to be done in D6 first and then backported.

andypost’s picture

StatusFileSize
new6.43 KB

Maybe my solution helps...
I use this module on 2 sites - it's just a quick solution.

After creating node you see a tab "Images" where 2 lists - one for attached image nodes and second is paged list of all image nodes.

andypost’s picture

Title: Attach Multiple Images with image_attach for D5 » Attach Multiple Images with image_attach

Removed D5 from title...

My solution for D6 and there's no blocks defined by module

Mark Theunissen’s picture

I tried to get v3 working but I get errors when I hit "preview":

    * warning: Invalid argument supplied for foreach() in /Users/mark/WWW/drupal-sandbox-5.7/modules/node/node.module on line 521.
    * warning: implode() [function.implode]: Invalid arguments passed in /Users/mark/WWW/drupal-sandbox-5.7/modules/node/node.module on line 525.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /Users/mark/WWW/drupal-sandbox-5.7/includes/database.mysql.inc on line 172.
maulwuff’s picture

Title: Attach Multiple Images with image_attach for D5 » Attach Multiple Images with image_attach
Version: 5.x-2.0-alpha1 » 6.x-1.x-dev
Status: Needs review » Needs work

I think you need to run update.php from the modules page in order to get rid of these errors.

coltrane’s picture

Status: Needs work » Closed (duplicate)

Closing this as a duplicate of #81102: Attach Multiple Images with image_attach using Drupal upload mechanism. If you want multiple images in image module there need to be patches that apply against the working development version which at this moment is the 6.x branch. Discussion and code should be consolidated as well.