Caption, Credit and Featured fields for Imagefield
tomchuk - January 23, 2008 - 07:58
| Project: | ImageField |
| Version: | 5.x-2.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active (needs more info) |
Description
So my lawyers told me they needed photo credits and my editors told me they needed captions and the ability to 'feature' a photo. I don't think this patch should be included, but I wanted to post it just in case it was useful to anyone.
| Attachment | Size |
|---|---|
| imagefield_caption.patch | 10.8 KB |

#1
#2
This is great, thank you! :)
#3
I implemented the patch - with errors...
patching file imagefield.installpatching file imagefield.module
Hunk #1 succeeded at 83 with fuzz 1 (offset -57 lines).
Hunk #2 FAILED at 123.
Hunk #3 succeeded at 277 (offset -105 lines).
Hunk #4 FAILED at 304.
Hunk #5 succeeded at 506 with fuzz 1 (offset -160 lines).
Hunk #6 succeeded at 546 (offset -159 lines).
Hunk #7 succeeded at 607 with fuzz 2 (offset -160 lines).
Hunk #8 FAILED at 723.
Hunk #9 succeeded at 671 (offset -230 lines).
Hunk #10 succeeded at 685 (offset -230 lines).
Hunk #11 FAILED at 697.
Hunk #12 succeeded at 706 (offset -229 lines).
Hunk #13 FAILED at 814.
Hunk #14 succeeded at 780 with fuzz 2 (offset -286 lines).
5 out of 14 hunks FAILED -- saving rejects to file imagefield.module.rej
...but I successfully performed update.php to version 3. How do I get this to work? I don't see how/where the functions would be implemented. I also really need this - thanks in advance!
#4
Will this be added to new versions of imagefield (like 6.x)? I absolutely love this feature.
#5
Following up on this - although the update to version 3 seemed to be successful, it actually did hose the module. After a lot of sturm and drang, I ended up going back to the original version - without caption and photo credit capability.
Keeping my eye out for a new version with these capabilities; in the meantime, it's still a great-looking module IMHO.
#6
I've updated this patch for Imagefield 5.x-2.1, in case anyone's interested.
#7
Yes - I'm very interested, but I can't get the patch to work. Terminal just hangs. If you have any other ideas (like posting the patched code for the module), that would be great - thanks much!
#8
There is some assistance on using the patch tool in the handbook: http://drupal.org/node/60108
Learning how to use it will help a lot as you learn Drupal.
However, since you asked, I've uploaded the two files you'll need here:
imagefield.install: http://pastebin.com/f3878a6c3
imagefield.module: http://pastebin.com/f74802b68
#9
Thank you! I've installed the updated versions and see the additional fields on the edit form, where they display in edit mode very nicely. However, the captions don't appear in the Imagefield Gallery view; I would think this would need to be provided for in the Imagefield Gallery module, which is what I'm using.
I'll try posting a link to this post as a support request over there - we could be only a few steps away from having a nice-looking lightbox gallery including captions!
Sorry for taking so long to get back - I was in Denver all last week - thanks again and keep up the great work!
#10
Glad someone is finding this patch useful. The original was against an early Imagefield-2.0 RC which is why the patch wouldn't apply cleanly, sorry for not updating.
I haven't used Imagefield Gallery, but it appears you're going to want to override theme_imagefield_gallery_lightbox2 in your theme to spit out the caption for the thumbnail and/or full views. It may be as simple as changing:
<?php$output .= theme('image', $file['filepath'], $images[$i]['alt'], $images[$i]['title']);
?>
to:
<?php$output .= theme('imagefield_image', $images[$i]);
?>
and tweaking some CSS, but I haven't used lightbox or Imagefield Gallery before, so it may require a little more work.
#11
just alter the theme_imagefield_gallery_lightbox2 function in your template.php to include the caption/credits in the alt and title attributes and it SHOULD show up just fine... btw you all are WAY off topic at this point. I'm hoping to have a fix for this in drupal 5 for the next version of imagefield gallery. Imagefield's primary purpose is allow you to upload images to nodes... Credits on that might be nice, but ultimately that's for dopry to decide, and he's busy working on the D6 version of imagefield, so I kind of doubt we'll see this in D5 any time soon unless someone comes up with money to ask him for it... HOWEVER I would imagine this can be done with another module that depends on imagefield.
Eclipse
#12
Thanks - in my configuration, the function appears in the actual module, not in my template.php, but even so, I tried making the change and... no joy.
I'll probably punt on this right now and see if there's another solution with captions for the next site I do; with all the great work everyone is doing around here, I'm not terribly concerned. Thanks for taking the time with all this - you guys (and girls) are the best!
#13
it's definitely something i will need! thanks for the contribution