2

I know about lightbox module, but I need a universal solution working with more than one jQuery plugin.

There is a view with image field displayed as a thumbnail and I'd like to link it to the normal image, and the link should have "rel" attribute.

How to implement it in the simplest way?

In the View->Fields->myfield properties, the first option (Link image to File) won't work because there is no option to insert "rel" attribute.

The second option is to REWRITE RESULTS and "Output this field as a link" and insert "lightbox" as a rel text. But what to write in the "Link path" textbox??

The path to image is: /sites/example.com/files/gallery/img1.jpg

  1. How to obtain the "/sites/example.com/files/" path other than just hardcode typing it? (it's a public:// stream)
  2. How to obtain the "img1.jpg" image name? I tried [field-image] replacement token but didn't work and there seem to be no fields that look like the file name.
  • Are you a coder and this that an option? – Alex Gill Jul 10 '12 at 12:16
0

You can install Image URL Formatter module. This will give you "Image URL" as a formatter option on Views.

So what to do is:

  1. Add the image field, and Exclude from display. Set the formatter as Image URL
  2. Add the same image field again. This one should be outputted as a thumbnail with Image Styles (perhaps), and have the normal "Image" formatter. Rewrite -> Output this image as a link, put the field added in step 1 to the link path.
  • This is producing strange results. See: img194.imageshack.us/img194/1007/scrp.png (on the screenshot I didn't exclude the image URL formatter from display only to illustrate the issue, so the URL formatter field is displayed at the top). After inserting [field_image_1] as link path, each image has the URL equal to all 6 URLs concatenated by comma, which results in Page not Found. Maybe there is something with grouping, I tried some combinations but no results. And here is the exported view: dl.dropbox.com/u/86167389/view.txt – camcam Jul 10 '12 at 11:59
  • It works fine on my installation. Perhaps your image field is a multi-value field? Then that's another issue, and you didn't mention it. – Beebee Jul 10 '12 at 12:20
  • Yeah, it's multivalue, sorry I didn't mention - it's a gallery - I corrected the title – camcam Jul 10 '12 at 12:24
  • I see, I'm not sure on how to handle that. Can you try the part after my edit on the above answer? – Beebee Jul 10 '12 at 12:42
  • All right, got it working. The first part of your solution was OK (before EDIT). One additional thing that has to be done is to uncheck the "Display all values in the same row" in Multiple field settings - then both fields (image and URL) are output paralelly and not grouped. This trick is described here: drupal.org/node/1578774 – camcam Jul 10 '12 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.