I have been pulling my hair out over the last few days, trying to find a way to combine a custom link field with an image field, to no avail. I could accomplish this with one image field value and one link field value through Views, but I can't do it with more than one value for each. (I have a content type with 3 image field values per node) At any rate, relying on Views for such a basic function seems unwieldy. Using the field collection module I can almost get there, but I still need to create a custom template for my content type in order to go all the way. For a variety of reasons, this is not a great solution. This particular site requires numerous content types and the ability to add more without necessarily having access to a Drupal developer. Any time a developer is required for basic functionality like this, it represents an extra cost to an entity that chooses Drupal as its CMS. I could also completely give up on image fields and try to accomplish this with a WYSIWYG editor and many lines of CSS, but again that's a long painful row to hoe just to wrap a link around an image.

There was a Link Image Field module but it has not been released for Drupal 7, and it works with a "link image" field instead of the existing image field. (The D7 release of this module seems to mired in red tape at the moment, maybe someone can expedite it)

http://drupal.org/node/949588

In my opinion, this should be part of core and it should work with image fields.

This seems like a fairly simple need: the ability to link an image to any URL we want. Presently, image field link options include "content" (the current node) the file itself, or "nothing." These are also managed through field display settings for all nodes of a content type (as opposed to being set with each image field value as it is uploaded on an individual node).

Comments

StatusFileSize
new41.09 KB

Below is a screenshot of the out of the box image upload interface in Wordpress. This has become what the average user expects from a CMS. I love Drupal but it is behind in this regard.

Wordpress Image Handling

Status:Active» Fixed

There is Link Image Field.

Status:Fixed» Active

Yes, I noted that in my post. It's not available for Drupal 7, does not have a current maintainer, and introduces another field type rather than working on the existing image field. At any rate, this really should be in core. Please do not mark this as fixed.

I don't think this is something that belongs in core. The philosophy of Drupal is quite different from Wordpress. If you need additional flexibility in Drupal, then this is usually provided by contributed modules. Having images link to external websites is not universally useful for all websites, so this is better off as a contributed module. This gives everyone the choice of using it or not. This is why the Link Image Field module exists.

Link Image Field has already been ported to D7 over a year ago. There is also an alternative version available which uses the core Image field, so your needs might already be covered. It might be hard to find these D7 versions because (as you know) the module is currently unmaintained and these downloads have not yet been made available on the project page. For the moment development is happening in a number of sandboxes until a new maintainer is appointed.

Here are some useful resources:

  • Initial D7 port of Link Image Field - this is the initial port by skilip as a zip file. It uses its own field, just like the D6 version.
  • Current 'stable' D7 sandbox - this is maintained by James Benison, based on the port by skilip. The latest version has additional bugfixes and is considered as stable. This is the most widely used D7 version.
  • Improved D7 version - this has been made by Droath based on James' sandbox. It uses a field formatter for the image field in core instead of defining an additional field type. This is probably the best implementation but it has not yet been widely tested.

I'm completely with you jenyum. I simply want to make an field image linkable so that it loads up an external site on click.

There can be such a thing as a too modular approach. This is basic functionality that is of common use. I think the drupal leaders need to consider what other users coming from other systems expect. A developer friend of mine was put off drupal by simply not understanding this approach. He thought it was too modular.

I realise there's a balance to be found here - that needs to be taken on a request by request basis so that core drupal doesn't become bloated. In this specific case I think a image should be linkable out of the box.

I just patched my version of Drupal 7.15 to allow image fields to link to any link field created by the link module. The patch adds the names of any link fields to the popup that appears when you click the gear icon next to an image field in the "Manage display" tab of the content type editor. Only the first link in a multiple-value link field is used.

For now I'm submitting this as a "do not test" patch because it's based on 7.15 rather than the latest development branch of Drupal, but if there's interest I will submit a more formal patch.

Version:7.14» 7.15

I'm definitely interested! Any other votes?

+1

I would love to see this as well.

Hi guys,

Thanks very much for your comments and feedback on this ticket, it was really a lot of help.

Following up with Add a link option to an image field, your comments and patch from #6, I went ahead and created a new formatter module with project at: #1837170: Image Link Formatter

I would greatly appreciate if I could have some of your feedback on this, since this module is mainly inspired from this particular discussion. It has already been tested, based on this use case:

  1. Configure a field Image
  2. Configure a field Link
  3. [Edit form is based on image and link fields' widgets]
  4. Configure the display formatter to wrap the link around the image

This formatter is based on the Link and Image modules and simply implements a display formatter.
Project's page contains more explanations about how this module would be different from other solutions mentioned above, such as Link Image Field or Custom Formatters, or any other solutions.

Please let me know if you would have any questions on any points/code/aspects mentioned in the project, I would surely be glad to provide more information.

Tests, feedback or comments in general are highly appreciated.

Thanks in advance.