Attach Multiple Images with image_attach using Drupal upload mechanism
aaron - August 28, 2006 - 13:32
| Project: | Image |
| Version: | 6.x-1.x-dev |
| Component: | image_attach |
| Category: | feature request |
| Priority: | normal |
| Assigned: | evil_marty |
| Status: | patch (code needs work) |
Description
This patch starts the ball rolling for allowing a node author to attach multiple images to a node. It allows multiple images to be submitted, although each image currently requires a preview or submit.
Still todo:
* allow multiple images to be submitted on a single form. (Multiple form elements? Ajax?)
* limit number of images allowed per node type
* allow weighting of order for display of images
* allow user to delete associations (will this also delete the image?)
- Aaron Winborn
Advomatic
| Attachment | Size |
|---|---|
| image_attach_multi.diff.txt | 6.87 KB |

#1
oops; that one had a debugging print_r. here's the proper one.
#2
I've modified the image_attach module to allow adding multiple images using the Drupal upload mechanism. This allows content creators to upload multiple images within the current page. Images that are not commited to nodes are deleted to ensure no junk or wasted space. This is my first contribution so I would love to get some feedback on this. Thanks =)
#3
Would be better if I double checked my work before I upload. Sorry guys this is the proper file =)
#4
Did you have to change that much that you have to provide the whole module? Would it be possible to provide a patch, that is easier to review? (http://drupal.org/diffandpatch) Now I have to diff manually to see if the .install has changed and stuff like that.
(btw, if you change the title on your comment you change the title of the issue, I've removed the "RE:")
#5
I replaced the original module by the one provided in your zip and when I try to attach an extra image to the node I get a javascript alter. It is attached to this comment.
#6
For those interested in this, I presented another solution here: http://drupal.org/node/87991
@evil_marty: I think I got the error because I didn't have the upload module enabled. I'll try again soon!
#7
JAX, your javascript error is in fact a 'not found' page.
You get this because your session didn't cache the newly added cachable path 'upload/image_js'. (see the menu hook)
With a new session it will certainly go better!
Cheers, Danny
#8
I have resolved a couple of problems with the 'image_attach' module from evil_marty.
The module continues to give nasty SQL errors. It seems like some other module goes haywire for some reason.
When one enters the edit page after having uploaded images, it gives this error for every uploaded image:
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /u/mount/photo/appdata/Logomatica/Sites/immovac/site/includes/database.mysql.inc on line 350.
user warning: Unknown column 'n.name' in 'where clause' query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, 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 n.uid = '1' AND n.name = 'admin' AND n.created = '1161868065' AND n.type = 'image' AND n.images = '' AND n.new_file = '' AND n.title = '' AND n.teaser = '' AND n.status = '' AND n.moderate = '' AND n.promote = '' AND n.sticky = '' AND n.revision = '' AND n.action_on = '' AND n.validated = '' AND n.is_new = '' AND n.nid = '' AND n.vid = '' AND n.changed = '' AND n.priority_override = '' in /u/mount/photo/appdata/Logomatica/Sites/immovac/site/includes/database.mysql.inc on line 121.
This query is clearly generated, which makes me think of search module involvement....
That's not part of this module, though.
Does anyone know where this comes from, and how to solve it?
Cheers, Danny
#9
Here is a new patch for the image_attach module.
I just hope Evil-Marty is not gonna shoot me for this...
TO DO:
The module probably doesn't respect access rights yet. It at least needs to check if the user can create images.
The updater in the .install file has not been tried at all.
Let me know what you think of it.
Cheers, Danny
#10
is it possible to preserve the "existing image" funtion ?
#11
sorry i have modify the title of the thread ?
#12
You could also change it back of course... anyway, I've done it now. ;)
I'm not sure about what you are trying to say.
Do you mean that existing images are discarded when you upload new ones?
That problem should be resolved if you applied the patch.
Danny
#13
In fact i want to preserve the new function : add existing image
and the function : add multiple image
but the patch erase it
are they incompatible ??
#14
Same thing here as above
Adding from existing image(that was upload via other nodes) is gone. That means have to upload new ones everytime even if I already have a existing image already in the image folder
(that was uploaded via other nodes).
#15
It seems like i've overlooked this feature completely.
I've started out with the code from evil-marty, which also doesn't have this feature in it.
I'm working on porting this feature from the CVS version to mine. It's pretty well finished now, but i want to do some extra checks.
I'll upload it on monday.
Stay tuned!
Danny
#16
This new version includes chances to attach existing images, as implemented in the existing CVS version.
#17
To add some extra's, here are the translation files for ITALIAN and DUTCH
Cheers, Danny
#18
I like this approach and the better upload UI. We also get the "detach" feature as a bonus. Unfortunately, the patch doesn't apply anymore.
#19
@David Lesieur
Too much has changed really for a patch, so i'll upload it completely module one of these days.
Currently i've added 'views' integration (first image only) and a feature to select a 'no images' image, which will be displayed with nodes that don't have any images attached.
I'm not finished with this yet, and the italian and dutch translations are outdated, so please hold on till' next week!
Cheers, Danny
#20
Thanks for the update, Danny! BTW, if you implement many features, I think you will have to split your work into separate, smaller patches, if possible, to increase the odds of them ever getting committed. ;-) Also, you might want to have a look at the Views integration that has been committed recently.
#21
what is the status of this? i'd really like to be able to attach more than one image to my cck nodes rather than upload one and do the rest through the file attachment section
#22
It's been almost a month now since i promised to upload a new version of this module.
Sorry about that, but i do have a lot of work on my hands, lately ;)
But at last, here it is!
I really wanted to add a complete zipped module, but this doesn't seem to be possible anymore.
So, i've created a megapatch that will apply agains the 4.7 version.
Status:
- It works very well and seems to be stable. I have it installed on live site, and i haven't had any problems with it, yet.
- Translations are available in Italian and Dutch.
- Views integration works as well. Only the first image can be shown, and you can choose one of the sizes from the image module.
@David Lesieur:
Thanks, i didn't know they added views support in the original. Too bad because i could have copied it, because not suprisingly, it is very similar.
Personally i think that a patch should never leave a module in an unusable state, so splitting it would be really difficult as one feature implies another or wouldn't make sense without the other.
Anyway, when i have a little more time at hand i'll look into this.
Cheers, Danny
#23
dvdweide, the translation should not be included in this patch. please submit it separately. and you should be using
cvs diff -upto generate the patches.#24
I am Wondering if anyone has submitted this functionality, or a patch for the drupal 5 version?
#25
OK, what's the status of this? The last patch seems to mention version 1.2.2.3 ... and I've currently checked out 1.9.2.4 and I can't seem to get it to apply. (yeah, and the po files don't help)
I came looking for the 'detach' button which seems to be missing, but multiples would be nice too, I guess.
I'd test, but currently cannot, as I suspect this patch is incompatable with DRUPAL-5.
#26
Hi there!
I am also interested in this patch very much. What's the current status? Is there a version for Drupal 5.x?
#27
For all those that requested status information on this patch, here are the short facts:
Until i finished my current project i can't switch to 5.0 myself, as this would include the porting of several custom-made modules.
I'm really sorry about this, but my hands are tied (yeah, i have a boss...)
Cheers,
Danny van der Weide
#28
Hi everbybody:
I need the path for 5.0, please any notice send a comment.
Thanks
#29
changing the version to reflect latest status
#30
can't image_attach be dropped in favor of http://drupal.org/project/upload_image ? at least with upload_image you have multiple image attach and deletion features ?
so i would suggest to mark it as won't fix
#31
Is there a 5.0 version already?
#32
Is this something that should be bountied? For it to be a true reverse bounty, we need a developer who can scope the amount of work required and what they would want to get for this.
#33
Hi
I have found 3 options for Drupal 5 which all do something similar.
I have not tried any of them yet.
http://drupal.org/project/node_images
http://drupal.org/project/pictures
http://drupal.org/project/slideshow
hope they work!
cheers
Sean
#34
hi guys, thanks for all your interests in the update. I'm sorry I haven't responded in a long time, unfortunately priorities at work were shifted etc. I am now working on migrating my company's sites to 5.0 and was going to update the module to work with it but as gaurdian (post #30) mentioned, I've replaced my use of image_attach with upload_image. This serves as a better implementation and intergrated well with other uploads. In saying that I believe it to be a better solution and unless there is a need for it I wont update the module. Sorry to all those that want this module, if you really do need an update let me know and if I have time can see what I can do. Thanks again guys.
#35
I'm using a multiple image_attach.module by evil_marty (with no patches 'cause I don't know how to patch a files) and I have a lot of errors in my site - in php "invalid argument supplied foreach()" and awful "duplicate entry" errors in my database which are off course very bad thing.
Do anybody have a solutions for my problems?
Maybe someone have a working module, already patched?
#36
marked http://drupal.org/node/220986 as a duplicate. i'd like to get this into 6.x-1.x and then backport to 5.x-2.x,
#37
Hey folks,
for a recent project of mine I wrote a version of the image_attach module using methods of the image module and the upload module. It needs xajax to work (for the removing of queued uploads). I just thought I could post it here, maybe it will be useful to somebody.
I hope you can excuse, that it's not a patch, but I didn't intend to provide it, so at the time of the project I simply started hacking and made a new module. I use it, it works fine as to my installation. If there are problems using it I can not guarantee to be able to help though. Right now I have different priorities.
But let me know if it works.
best regards,
Hadubard
#38
Marked http://drupal.org/node/228560 as duplicate.
#39
Subscribing.
#40
subscribing
#41
Subscribing.
#42
Updating back to maintainers wishes
#43
Also subscribing... this is popular!
#44
Subscribing.
#45
Hi,
How would one go about installing xajax? I can't find the module :/
Best regards,
Michael :)
#46
subscribing
#47
I found out how to do it...
Download the module here: http://daryl.learnhouston.com/2005/11/21/xajax-in-drupal/
#48
also see http://drupal.org/node/253503.
#49
+1 this feature, it solves a huge hole in drupla functionality, look forward to the development
#50
subscribing
#51
subscribing, I'm waiting for this feature to fix all current problems with image_attach in drupal 6.x ;)
#52
add
#53
D5ers: have a look at this patch:
http://drupal.org/node/267806