I've tried Drupal 7 beta which now embeds CCK Image fields, but not found how to setup a image field with link URL...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalku.net’s picture

+1
Waiting for D7 port

www.drupalku.net

mattcoady’s picture

Yes, this needs to happen.

TimG1’s picture

+1 Subscribing. Are there plans to make a D7 version?

didox’s picture

Subscribing

skilip’s picture

FileSize
4.37 KB

Here's a Drupal 7 port.

vervecreations’s picture

Skilip. Are you kidding me!?! I just finished porting this 15 minutes ago as a great "learn drupal 7 module writing" project. It took me three days of debugging and going through the drupal module writing learning curve. I was about to post it and you already did it early this morning! ;)

Nice work on it. It has a few extra options that mine didn't have. Looks like you went about it the same way I did, inheriting from the image field wherever possible. This will be greatly useful in many projects. Great job once again.

skilip’s picture

@vervecreations: That is a dipper indeed! We should have joined forces! At least we both have learned a lot about Field API ;).

vervecreations’s picture

Oh well, the education was indeed worth it regardless :) Thanks for your work on it!

carlos.macao’s picture

Component: Miscellaneous » Code
Category: feature » bug
Priority: Normal » Major

I've installed the #5 attachment. But after following the rules of the README file, I can't see any box for inserting the URL, the cck works exactly the same as the image field.

eule’s picture

#9 same here ... i test it now..it works only after you have uploaded a picture..thats crazy ;)

cwyant’s picture

Same problem here. Field is added to content type, but it still behaves like the regular image upload field.

damiandab’s picture

I dont understand you (#9, #10, #11).

Its working as designed (see attachment picture).

Create a new linkimagefield through the Field interface:
Visit Administer ->Structure -> Content types (admin/structure/types), then click
Manage fields on the type you want to add an image upload field.
Select "Link Image" as the field type and "Link Image" as the widget type to create a new field.

@eule > of course you have first to upload image to could link this image ;)

eule’s picture

I'm probably understand the module wrong...i look for a img field who i can add a url for an existing image. so thats the user not need to upload a picture. i look for a quick way to let users paste a img url...is there something?

damiandab’s picture

Yes, I think also the module should extend the type "image" and not to create new type "Link image".
It should works something like an option in configuration of image field , example: "Enable External Url field " , the same like for "Enable Alt field" or "Enable Title field".

I think we should create new issue in "feature request" category.

Till know a solution I would use is to create 2 field types: image and link field(http://drupal.org/project/link) and then rewrite node template for the node type you are using for these 2 fields.
You can also use the contemplate module: http://drupal.org/project/contemplate.

If you want to display linked image with views , you can very easy add 2 fields(image and link) , exclude them and then add another node field(title or link) and rewrite the output using replacement patterns, example:

<a href="[here_comes_pattern_for_link]">[here_comes_pattern_for_image] </a>
skilip’s picture

The module attached here is a port of the Drupal 6 version of Image Link. The original module works the same; it adds a 'Link Image' field with which you can create links with images instead of text.

Only adding a widget which can be selected while creating a regular Image field would require the Image field schema to be altered. In that way, all fields of the image type will have an extra database column for the 'url' field. That's not really a good idea IMHO. Creating a separate issue for that is though ;).

damiandab’s picture

@skilip
I meaned to create an extension for image field that add new option "Enable External Url field ", so it could work with another widgets, for example image crop. Of course new database column would be necessary. Why you mean its not a good idea?

crised’s picture

Hello I am able to do this but... I get a lot of errors:

Notice: Undefined index: url_settings in linkimagefield_widget_process() (line 215 of /home/crised/public_html/modules/linkimagefield/linkimagefield.module).
Notice: Undefined index: url_settings in linkimagefield_widget_process() (line 220 of /home/crised/public_html/modules/linkimagefield/linkimagefield.module).
Notice: Undefined index: url_settings in linkimagefield_widget_process() (line 221 of /home/crised/public_html/modules/linkimagefield/linkimagefield.module).
Notice: Undefined index: url_settings in linkimagefield_widget_process() (line 226 of /home/crised/public_html/modules/linkimagefield/linkimagefield.module).
Notice: Undefined index: url_settings in linkimagefield_widget_process() (line 234 of /home/crised/public_html/modules/linkimagefield/linkimagefield.module).
Notice: Undefined index: insert in insert_element_process() (line 170 of /home/crised/public_html/sites/all/modules/insert/insert.module).

Damiandab, please provide a more detailed explanation of how to link an image with link module. I have already download it, but what is the file pattern?

P.D: How can be possible that something as simple as linking an image can be so difficult?

Mark Nielsen’s picture

Crised, are you using the Contemplate module?

I have to say that I don't think using the standard link and image field modules together is perfect, as you couldn't easily create multiple linked images.

How can be possible that something as simple as linking an image can be so difficult?

Generally, it's not. A WYSIWYG editor is a more common route for this. By going down the route of image fields (especially using link and image fields together), you're choosing to build your own specific implementation. These modules naturally need thinking about a bit more because they're designed to be so flexible and abstracted.

crised’s picture

No I'm not using it. Should I? I will install it.

crised’s picture

Dear Mark,

Contemplate module did the trick!

but... there is still an error when I edit the page:
Notice: Undefined index: insert in insert_element_process() (line 170 of /home/crised/public_html/sites/all/modules/insert/insert.module).

joostvdl’s picture

Category: bug » feature
Status: Active » Needs review

Module from #5 works very good.

Can one of the maintainers create a 7.x version so working on this module can continue?

AndyZhang’s picture

subscribing

rowbeast’s picture

subscribing +1

jmix’s picture

Hi, the module is working on my D7 install, but there's no way to choose the target for links (_blank, _self etc...).
I see a line of code for that in linkimagefield.module (line 371+), but can't see the option in D7 administration.
I'm very new to Drupal, so totally unable to modify that by myself. Any idea ?
Thanks.

dsdart’s picture

Thanks - just what I needed

plastikkposen’s picture

+1

desrosj’s picture

Subscribe

luckystrikerin’s picture

+1

MrPaulDriver’s picture

Subscribe

magohata’s picture

The Module work for me, but not exacly what i expected

i want to have the option to a externarl URL with the Field Slideshow module

I can not make them work together, because this module has its own method to upload pictures and the external URL as a link fild but I can not select the format SlideShow in the content type from the module Field SlideShow

Anonymous’s picture

EDIT: #5 works for me. However, I'm getting this error when trying to use a default image:

Notice: Undefined index: url in theme_linkimage_formatter() (line 353 of /home/xxxxxx/public_html/sites/all/modules/linkimagefield/linkimagefield.module).

dopla’s picture

sachbearbeiter’s picture

sub

jamesbenison’s picture

This project appears to be abandoned as there has not been any commits made in two years. The maintainers also do not appear to be active members of the community anymore based on their posting history. Yet this project still has over 3000 users.

I'm proposing that for the short term we set up a sandbox for the code that is currently working. That way we can at least have a repo for downloading code and committing patches.

The next logical step would be for somebody to take over as the new maintainer. Seems like skilip or vervecreations would be logical choices for this.

See this page for dealing with abandoned projects: http://drupal.org/node/251466

jnettik’s picture

subscribing

jamesbenison’s picture

I have set up a sandbox code repository.

Located here: http://drupal.org/sandbox/jamesbenison/1275344

westside85’s picture

Assigned: Unassigned » westside85

Works for me demo , but still shows an error message after I delete the caches errors disappear.

pfrenssen’s picture

Title: How to migrate Link Image Fields to Drupal 7 » Drupal 7 port of Link Image Fields

Changing title.

I am now testing the D7 version in #36 and it seems to be fine. The code seems ok too on first glance.

pfrenssen’s picture

I am using the D7 version in #36 in production now, it is feature complete and stable.

Jason Dean’s picture

#36 working great for me in production sites - thanks!

Anonymous’s picture

-

sondes’s picture

I'm using the code with no problems! Thanks so much!!

stefanp’s picture

Assigned: westside85 » Unassigned
Priority: Major » Minor
Status: Needs review » Fixed

the attached zip file works perfectly just followed the readme and edit the custom content i had.

pfrenssen’s picture

Priority: Minor » Major
Status: Fixed » Reviewed & tested by the community

Updating status since there were multiple reports of the port working fine.

jamesbenison’s picture

Problem isn't totally solved. The code hasn't been migrated to an official project and we need a maintainer. I'm already overextended, but I'm always happy to help when I can.

lyle@4fs’s picture

You are a genious and a scoller sir . I have been looking for this forever, on my birthday.. shot!!!!

lyle@4fs’s picture

Damn gave me errors in drupal 7.10 ..

jhrizz’s picture

Subscribing... This capability should be in the core, IMHO

DERIIIFranz’s picture

I'm using the D7 port and it worked well for me up to now. But now I think I'm facing a bug.
Every image I include on my site using linkimagefield with NO specified url links to my landing page by default! Maybe it's interesting that my site is multilingual using i18n. Here's a test-link to my site where the bug occurs: http://www.freundlinger.net.config06.itandtel.at/de/content/planung

edit: every image of the german versions links to "/de" and to "/en" in my english version..

DERIIIFranz’s picture

Category: feature » bug

i solved this problem now by simply changing

  if (isset($item['url']))

to

  if (isset($item['url']) && $item['url'] != '')

maybe this should be considered for the next release

pfrenssen’s picture

@DERIIIFranz, the D7 version of this module is maintained in a sandbox. To make sure the maintainer sees it you might want to create a new issue here: http://drupal.org/project/issues/1275344

When you discover a new bug it is usually a good idea to make a separate issue, that makes it easier to work on and get it fixed.

pfrenssen’s picture

Marked #951742: Port "Link Image Field" to Drupal7 as a duplicate of this issue.

damiandab’s picture

I tested both modules: from 'skilip ' and a sanbox project of 'jamesbenison' and I get warning message, when I set unlimited values in 'number of values' and add another item:


Warning: ksort() expects parameter 1 to be array, null given in drupal_group_css() (line 3102 of /var/www/vhosts/<drupal_root>/includes/common.inc).

jamesbenison’s picture

I believe pfrenssen is planning to run this show on the d7 side. His project application is pending if I am not mistaken.

ParadiseCircus’s picture

jamesbenison’s picture

I don't like the way the drupal 7 port is done at all. It declares a new field type instead of being a field widget/formatter.

If somebody could finally answer this (http://drupal.org/node/1526940), which has been a vexing problem for me for WAY too long, I will make a proper version of this module. And you will have answered a question posed by hundreds...that has been asked by countless developers...and has never been properly answered.

For instance,
Page 99 in the book Drupal 7 Module Development uses the following example:

$block['content'] = array(
  '#theme' => 'item_list__single_blog',
  '#items' => $items,
);

Yet nowhere in his book that I can find has he shown an example of how the function 'item_list__single_blog' can be created to override the function 'theme_item_list'. I've declared it every freaking way I can think of. Still it never gets called.

This is totally out of control. I have a bunch of stuff that needs to have this issue rectified before I can go forward on several projects. I'm not putting anymore hack crap code on drupal git.

This module needs several core theme functions to be overridden in order to work properly.

jamesbenison’s picture

If your answer requires using hook_theme_registry_alter() then don't bother.

If that is what is required it means that core is broken and we need to create a new issue there.

jamesbenison’s picture

Status: Reviewed & tested by the community » Active

Changing status

pfrenssen’s picture

The initial port done by Skilip was probably based on an old version of the module. The current D6 version has been refactored and has received a number of updates which are not present in the current D7 port. The problem is that these changes date back to the CVS days, when it was common to commit a large number of changes in one single patch. This makes merging in the latest changes to the current D7 port practically impossible.

I have made a sandbox (Link Image Field (fork)) where I have cleaned up the branches, and applied some additional patches from the queue. If you intend to make a new D7 port then maybe best start from there.

jamesbenison’s picture

Actually that rant above was something I've been silent about for a long time.

My feeling is that in drupal 7 we should not be defining a new field at all. It should be an "image" field. And we should select the link image widget when we add it to content.

An excellent example of this is how the media module (7.x-2.x) can take a "file" field and use it for youtube, vimeo, or whatever. It should be really simple for us to take our image field and wrap it in a custom link.

The correct approach may require a pretty substantial overhaul of the module.

jamesbenison’s picture

Project: Link Image Field » Drupal.org site moderators
Version: 6.x-1.x-dev »
Component: Code » Project ownership
Category: bug » task

Okay, I just had the pleasure of developing a new module that would stand to benefit greatly from this one (http://drupal.org/project/imageflow). And it gave me a chance to rethink my "problem" with a linked image being a new field type.

Both approaches have their advantages and disadvantages. But I can see where making this an official project as it stands would provide great benefit.

Moving this to the webmasters' queue. Challa and son of whatever have not gotten back to me despite repeated attempts.

jamesbenison’s picture

John Young just replied to me. He does not have permissions to grant me project access.

Challa said "go for it" months ago but did not grant me access. Attempts to reach him again have been unsuccessful.

This is up to the drupal admins.

jamesbenison’s picture

Theme hook suggestions as described above seem to NOT WORK.

From what I can tell you must use hook_theme()

EDIT: This was supposed to be a response to #56. Even then it's still out of place. My apologies.

sreynen’s picture

Project: Drupal.org site moderators » Link Image Field
Version: » 6.x-1.x-dev
Component: Project ownership » Code
Category: task » bug

Sorry to delay this further, but we have a defined process for this to avoid problems. Please follow http://drupal.org/node/251466 to be added as a maintainer of the project. It sounds like you've already contacted the owner directly, so you just need to open an issue specifically about becoming maintainer. If the current owner does not approve or reject your request in 2 weeks, webmasters will then transfer ownership.

jenyum’s picture

Subscribing. Desperate for progress on this.

skilip’s picture

Since I've ported the D6 version to D7, I'm also willing to take over maintainership of this module.

jenyum’s picture

Skilip and/or Jamesbenison, please open a separate issue requesting maintainership. My understanding is nothing will change until someone does that.

sreynen’s picture

jenyum, that's correct. The policy at http://drupal.org/node/251466 requires a maintainer-specific issue before webmaster intervention.

droath’s picture

I have been working on a fork of the "Link Image Fields" project that Skilip and Jamesbenison ported over. I have added a substantial amount of code to improve not having to define a separate field for link images. I'm willing to join forces to get this project official.

https://drupal.org/sandbox/droath/1564916

jenyum’s picture

Droath, can you start an issue asking to be a maintainer? Someone needs to do this ASAP. Three maintainers would probably be great, but we need at least one.

pfrenssen’s picture

@jenyum, since the module has not been maintained for over two years, there's no absolutely no need to rush. Please don't put pressure on people like this. Remember people are doing this for free in their spare time.

alicious’s picture

Category: bug » support
Priority: Major » Normal

So, as a Drupal user, how do I actually link an image without using an outdated module? I've been using Link Image but the "default image" feature is broken and every day the default image disappears. I feel like I must be missing something, since adding a link to an image is a pretty basic feature... Is there a simpler way to do this?

jamesbenison’s picture

I cannot lie. I tried to delay delay delay in the hopes that someone would take this project that everyone seems to need but looks at like it's the redheaded step child.

http://drupal.org/project/linkimagefields

It's official.

But PLEASE not for my sake but for the sake of other drupal users help out with this.

A co-maintainer and patches would be great places to start.

Thanks

jamesbenison’s picture

Core for sure handles dimensions now.

Drupal's theme image should now also handle any image attributes. I don't know if they currently work with the module because I haven't tested it recently. If they don't it shouldn't be very difficult to fix it.

The module description has long been obsolete. I will make a note.

sreynen’s picture

jamesbenison, please consider removing that project before creating releases. If you're willing to maintain the code, the existing project is the best place to do that, since everyone who has used and contributed to this project is already collaborating here. We have a clear process for taking over existing projects. Please do that rather than creating confusion with a separate project.

jamesbenison’s picture

I believe I went through that process after not hearing back from the original maintainer. It has been so long that I don't even remember. But I'll double check and pull down releases.

I agree that this is a much better place for it.

jamesbenison’s picture

Title: Drupal 7 port of Link Image Fields » Project Link Image Field appears to be abandoned
Project: Link Image Field » Drupal.org site moderators
Version: 6.x-1.x-dev »
Component: Code » Project ownership
Category: support » task

This has been ongoing for nearly a year.

http://drupal.org/project/linkimagefield

I did successfully get in touch with Challa. He told me I should go ahead and take over the project, but he never granted me maintainer permissions. I believe that was back in November. I held off on promoting a sandbox for many months, but I finally gave in (http://drupal.org/project/linkimagefields). However, as a user has correctly pointed out, it would be preferable to take over maintainership of this project as opposed to creating a new one (too late, but I can abandon it before people start downloading it).

Danny Englander’s picture

Title: Drupal 7 port of Link Image Fields » Project Link Image Field appears to be abandoned
Project: Link Image Field » Drupal.org site moderators
Version: 6.x-1.x-dev »
Component: Code » Project ownership
Category: support » task
Status: Closed (fixed) » Active

Maybe I am stating the obvious but I think there is a clear set of steps and actions for taking over an existing project that has been abandoned. Dealing with unsupported (abandoned) projects At any rate, thanks for all the hard work!! :)

jamesbenison’s picture

Title: Project Link Image Field appears to be abandoned » Offering to take over link image field

Please point out what I might have missed.

I'm kinda juggling several things right now. At a glance I didn't see anything that sticks out, but if I'm overlooking the obvious it wouldn't be the first time.

Is it the name of the issue title? Everything else looks legit.

sreynen’s picture

Title: Offering to take over link image field » Drupal 7 port of Link Image Fields
Project: Drupal.org site moderators » Link Image Field
Version: » 6.x-1.x-dev
Component: Project ownership » Code
Category: task » support

Please point out what I might have missed.

From the process:

File an issue in that project's queue under the "support request" category stating your request to take over maintainership.

I don't see an issue for this.

But that's irrelevant, since it appears you are already a maintainer on this project. If you aren't able to make a release, feel free to ask for help.

jamesbenison’s picture

Either my maintainer privileges are new or I have been blind.

I'll push the 7.x code up asap. We can take it from there.

jamesbenison’s picture

Status: Active » Closed (fixed)

7.x-1.x has been branched and pushed. After many long months we can finally close this thread.

The download should be available shortly.

pfrenssen’s picture

Title: Project Link Image Field appears to be abandoned » Drupal 7 port of Link Image Fields
Project: Drupal.org site moderators » Link Image Field
Version: » 6.x-1.x-dev
Component: Project ownership » Code
Category: task » support
Status: Active » Closed (fixed)

Great news, congratulations! Which port are you using? The one by skilip or the one by droath? I did not find the time yet to look at droath's version, but it seemed promising. As long as we are in dev we can still switch versions I guess.

jamesbenison’s picture

I used the one that was in my sandbox. It's effectively skilip's port with a few enhancements.

In the longer term I think the wise thing to do would be to look at droath's version and consider making it the 7.x-2.x branch. It's a pretty radical departure from the current module. To me his approach makes far more sense. We should probably start a new thread on it to get user input.

I wanted to get something up quickly that I know works. So using a fairly vanilla port for 7.x-1.x seemed like a good idea. At least now users now have official support and the drupal security teams keeping watch.

I tried to create an alpha1 last night. But, for some reason it wasn't allowing me. I don't know if I'm lacking a permission or I'm doing something wrong. But I've never had a problem with tagging a release before.

drupalok’s picture

can you please make a dev release? please please please :)

drupalok’s picture

sorry... I was blind... its already there

droath’s picture

@jamesbenison

I'm following up with what we talked about over here on this thread:

https://drupal.org/node/1275382#comment-6018406

Let me know if you still want to go ahead with the 7.x-2.x branch of Link Image Fields which would be based off the work I have been doing on: https://drupal.org/sandbox/droath/1564916. I'm more then willing to help co-maintain this module with you, so we can get this long awaited module a stable release.

Let me know...

jamesbenison’s picture

@droath

I'm all on board with you. My permissions on this project are limited. If it was up to me it would already be done.

I've been busting my A for client needs the past couple weeks. When I have a chance to breath I'll get back to the fun stuff. Give me a few days and I'll see what I can do.

Thanks for the work you've put in.

Jim

jrochate’s picture

Well...

Thinking about future web searchers, here is how I link images to a link, on a view:

1. Start with a content type that has, at least, an Image field (D7 built-in) and a Link field (module)
2. Create a view and add both fields to FIELDS
3. Order fields where Content:Link comes first and Content: Image comes after
4. On Content:Link settings, choose Exclude from display
5. On Content:Image settings, set "Link image to" nothing and expand "Rewrite results"
6. Check "Output this fields as a link" and on Link path text box, insert the replacement pattern that corresponds to the Link field
(scroll down to "Replacement patters" in order to copy&paste the right pattern
7. Apply and Save

That's it.

Now you can tweak with settings, in order to get url opened on a new page, etc.

Hope that helps someone.

sahuni’s picture

well #89 works if we do not give a text in the link field.
But if we give a text to the link field, it does not work.
Case is : in a view we want the link from the link text and in another view we want the link from the image.
In that case the link does not use the url but the text.

  • Commit 5755b3f on 7.x-1.x, 8.x-1.x:
    Issue #949588: fixed drupal 7 port of link image field.