I have a view of users, I'm displaying a number of fields, I want to output the path to the image, without rendering any of the html around it, I cant seem to figure out how to do this.


The easier option is:

  1. Go to Configure field

  2. "Rewrite results" and check "Rewrite the output of this field"

Add whatever html you want to display your image field. Below you can find "Replacement patterns". Those are tokens you can use in your html.

And the more advanced option is to:

  1. Go to "Advanced" (on the right side of your view)
  2. Theme: Information

Here is a link that can help you with that: http://www.group42.ca/theming_views_2_the_basics

  • Thanks, there was no replacement pattern matching just the raw source. I ended up going and creating a field template and using DOMdoc to pare the src tag out, perhaps not the best solution, but it worked – user379468 Sep 29 '12 at 15:14
  • Glad you found a solution. I once used the replacement pattern for the image title ([field_image-title]) and created the source for the image like this: src="sites/default/files/[field_image-title].jpg". This can be a problem if the image extension varies or the location of the images, but sometimes can be a good quick solution. – Denchev Sep 29 '12 at 15:38

I found that "there's a module for that", Image URL Formatter:

This module add a url formatter for image field. Then you can output image url directly.

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.